Build Caddy #521
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Caddy | |
on: | |
repository_dispatch: | |
workflow_dispatch: | |
inputs: | |
commit: | |
description: 'Back to Commit' | |
required: false | |
default: '' | |
schedule: | |
- cron: '0 11 * * 1' | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "windows-amd64", | |
GOARCH: amd64, | |
GOOS: windows, | |
release: true | |
} | |
- { | |
name: "linux-amd64", | |
GOARCH: amd64, | |
GOOS: linux, | |
release: true | |
} | |
- { | |
name: "linux-arm64", | |
GOARCH: arm64, | |
GOOS: linux, | |
release: true | |
} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
check-latest: true | |
- name: Remove old Releases | |
uses: ClementTsang/delete-tag-and-release@main | |
with: | |
delete_release: true | |
tag_name: caddy | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install xcaddy | |
run: go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest | |
- name: Build caddy | |
run: | | |
mkdir release-tmp | |
export GOARCH=${{ matrix.config.GOARCH }} | |
export GOOS=${{ matrix.config.GOOS }} | |
~/go/bin/xcaddy build master \ | |
--with github.com/mholt/caddy-l4 \ | |
--with github.com/caddy-dns/alidns \ | |
--with github.com/caddy-dns/cloudflare \ | |
--with github.com/caddy-dns/dnspod \ | |
--with github.com/caddy-dns/duckdns \ | |
--with github.com/mholt/caddy-dynamicdns \ | |
--with github.com/mholt/caddy-events-exec \ | |
--with github.com/WeidiDeng/caddy-cloudflare-ip \ | |
--with github.com/xcaddyplugins/caddy-trusted-cloudfront \ | |
--with github.com/caddyserver/forwardproxy=github.com/klzgrad/forwardproxy@naive \ | |
--with github.com/imgk/caddy-trojan \ | |
--with github.com/mholt/caddy-webdav \ | |
--with github.com/aksdb/caddy-cgi/v2 \ | |
--output ./release-tmp/caddy | |
- name: Rename for Windows | |
if: matrix.config.GOOS == 'windows' | |
run: | | |
mv ./release-tmp/caddy ./release-tmp/caddy.exe | |
- name: Generate zip for Windows | |
if: matrix.config.GOOS == 'windows' | |
run: | | |
mkdir release-ready | |
cd ./release-tmp | |
zip -r ../release-ready/caddy-${{ matrix.config.name }}.zip * | |
- name: Generate tar for other platform | |
if: matrix.config.GOOS != 'windows' | |
run: | | |
mkdir release-ready | |
cd ./release-tmp | |
tar -zcvf ../release-ready/caddy-${{ matrix.config.name }}.tar.gz * | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: caddy-${{ matrix.config.name }} | |
path: ./release-ready/* | |
- name: Upload firmware to release | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: caddy | |
files: ./release-ready/* | |
# - name: Delete workflow runs | |
# uses: Mattraks/delete-workflow-runs@main | |
# with: | |
# retain_days: 1 | |
# keep_minimum_runs: 1 |