Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
nap0o authored Dec 26, 2023
1 parent 4c4856a commit b79e234
Show file tree
Hide file tree
Showing 4 changed files with 261 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/caddy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build caddy Compress with UPX

on:
workflow_dispatch:
#push:
# branches:
# - main
schedule:
- cron: 0 16 */7 * *

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Compress with UPX
run: |
# install upx
wget https://github.com/upx/upx/releases/download/v4.2.1/upx-4.2.1-amd64_linux.tar.xz
tar -Jxf upx*.tar.xz
sudo cp upx*/upx /usr/bin
# set work dir
mkdir -p musldist
cd musldist
# linux_amd64
CADDY_LATEST=$(wget -qO- "https://api.github.com/repos/caddyserver/caddy/releases/latest" | awk -F [v\"] '/"tag_name"/{print $5}' || echo '2.7.6')
wget -c https://github.com/caddyserver/caddy/releases/download/v${CADDY_LATEST}/caddy_${CADDY_LATEST}_linux_amd64.tar.gz -qO- | tar xz -C ./ caddy
chmod +x caddy
upx -1 caddy
- name: Upload dist
uses: actions/upload-artifact@main
with:
name: caddy
path: |
musldist
- name: Generate release tag
id: tag
run: echo "::set-output name=release_tag::caddy"

- name: Create release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.release_tag }}
files: |
musldist/*
- name: Remove old Releases
uses: dev-drprasad/[email protected]
if: env.UPLOAD_RELEASE == 'true' && !cancelled()
with:
keep_latest: 1
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_KEY }}
65 changes: 65 additions & 0 deletions .github/workflows/cloudflared.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build cloudflared Compress with UPX

on:
workflow_dispatch:
#push:
# branches:
# - main
schedule:
- cron: 0 16 */10 * *

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Compress with UPX
run: |
# install upx
wget https://github.com/upx/upx/releases/download/v4.2.1/upx-4.2.1-amd64_linux.tar.xz
tar -Jxf upx*.tar.xz
sudo cp upx*/upx /usr/bin
# download cloudflared
mkdir -p musldist
cd musldist
wget -qO cloudflared-linux-amd64 https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64
wget -qO cloudflared-linux-arm64 https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-arm64
chmod +x cloudflared-linux-amd64
chmod +x cloudflared-linux-arm64
cp cloudflared-linux-amd64 cloudflared-linux-amd64-source
cp cloudflared-linux-arm64 cloudflared-linux-arm64-source
# do upx Compress
upx -1 cloudflared-linux-amd64
upx -1 cloudflared-linux-arm64
- name: Upload dist
uses: actions/upload-artifact@main
with:
name: cloudflared
path: |
musldist
- name: Generate release tag
id: tag
run: echo "::set-output name=release_tag::cloudflared"

- name: Create release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.release_tag }}
files: |
musldist/*
- name: Remove old Releases
uses: dev-drprasad/[email protected]
if: env.UPLOAD_RELEASE == 'true' && !cancelled()
with:
keep_latest: 1
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_KEY }}
71 changes: 71 additions & 0 deletions .github/workflows/nezha-agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build nezha-agent Compress with UPX

on:
workflow_dispatch:
#push:
# branches:
# - main
schedule:
- cron: 0 16 */10 * *

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Compress with UPX
run: |
# install upx
wget https://github.com/upx/upx/releases/download/v4.2.1/upx-4.2.1-amd64_linux.tar.xz
tar -Jxf upx*.tar.xz
sudo cp upx*/upx /usr/bin
# set work dir
mkdir -p musldist
cd musldist
# linux_amd64
wget -O nezha-agent_linux_amd64.zip https://github.com/nezhahq/agent/releases/latest/download/nezha-agent_linux_amd64.zip
unzip -qod ./ nezha-agent_linux_amd64.zip
mv nezha-agent_linux_amd64.zip nezha-agent_linux_amd64-source.zip
upx -1 nezha-agent
zip nezha-agent_linux_amd64.zip nezha-agent
rm nezha-agent
# linux_arm64
wget -O nezha-agent_linux_arm64.zip https://github.com/nezhahq/agent/releases/latest/download/nezha-agent_linux_arm64.zip
unzip -qod ./ nezha-agent_linux_arm64.zip
mv nezha-agent_linux_arm64.zip nezha-agent_linux_arm64-source.zip
upx -1 nezha-agent
zip nezha-agent_linux_arm64.zip nezha-agent
rm nezha-agent
- name: Upload dist
uses: actions/upload-artifact@main
with:
name: nezha-agent
path: |
musldist
- name: Generate release tag
id: tag
run: echo "::set-output name=release_tag::nezha-agent"

- name: Create release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.release_tag }}
files: |
musldist/*
- name: Remove old Releases
uses: dev-drprasad/[email protected]
if: env.UPLOAD_RELEASE == 'true' && !cancelled()
with:
keep_latest: 1
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_KEY }}
64 changes: 64 additions & 0 deletions .github/workflows/nezha-dashboard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build nezha-dashboard Compress with UPX

on:
workflow_dispatch:
#push:
# branches:
# - main
schedule:
- cron: 0 16 */7 * *

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Compress with UPX
run: |
# install upx
wget https://github.com/upx/upx/releases/download/v4.2.1/upx-4.2.1-amd64_linux.tar.xz
tar -Jxf upx*.tar.xz
sudo cp upx*/upx /usr/bin
# set work dir
mkdir -p musldist
cd musldist
# linux_amd64
DASHBOARD_LATEST=$(wget -qO- "https://api.github.com/repos/naiba/nezha/releases/latest" | awk -F '"' '/"tag_name"/{print $4}')
wget -O dashboard.zip https://github.com/naiba/nezha/releases/download/$DASHBOARD_LATEST/dashboard-linux-amd64.zip
unzip dashboard.zip -d ./
mv -f ./dist/dashboard-linux-amd64 ./app
rm -rf ./dist ./dashboard.zip
chmod +x app
upx -1 app
- name: Upload dist
uses: actions/upload-artifact@main
with:
name: nezha-dashboard
path: |
musldist
- name: Generate release tag
id: tag
run: echo "::set-output name=release_tag::nezha-dashboard"

- name: Create release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.release_tag }}
files: |
musldist/*
- name: Remove old Releases
uses: dev-drprasad/[email protected]
if: env.UPLOAD_RELEASE == 'true' && !cancelled()
with:
keep_latest: 1
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_KEY }}

0 comments on commit b79e234

Please sign in to comment.