-
Notifications
You must be signed in to change notification settings - Fork 18
61 lines (53 loc) · 1.7 KB
/
upx-caddy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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 }}