Skip to content

Build Caddy

Build Caddy #25

Workflow file for this run

name: Build Caddy
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
config:
- {
name: "windows-arm64",
GOARCH: arm64,
GOOS: windows,
release: true
}
- {
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
}
- {
name: "darwin-amd64",
GOARCH: amd64,
GOOS: darwin,
release: true
}
- {
name: "darwin-arm64",
GOARCH: arm64,
GOOS: darwin,
release: true
}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install go
uses: actions/setup-go@v3
with:
go-version: '1.21'
check-latest: true
- name: Install xcaddy
run: go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
- name: Build caddy
if: matrix.config.GOOS == 'windows'
run: |
mkdir release-tmp
export version=$(curl -s "https://api.github.com/repos/caddyserver/caddy/releases/latest" | jq -r .tag_name)
export GOARCH=${{ matrix.config.GOARCH }}
export GOOS=${{ matrix.config.GOOS }}
~/go/bin/xcaddy build \
--with github.com/mholt/caddy-l4 \
--with github.com/caddy-dns/cloudflare \
--with clevergo.tech/caddy-dnspodcn \
--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/caddyserver/forwardproxy@caddy2 \
--with github.com/imgk/caddy-trojan \
--with github.com/mholt/caddy-webdav \
--output ./release-tmp/caddy_${version}_${{ matrix.config.name }}.exe
- name: Build caddy
if: matrix.config.GOOS != 'windows'
run: |
mkdir release-tmp
export version=$(curl -s "https://api.github.com/repos/caddyserver/caddy/releases/latest" | jq -r .tag_name)
export GOARCH=${{ matrix.config.GOARCH }}
export GOOS=${{ matrix.config.GOOS }}
~/go/bin/xcaddy build \
--with github.com/mholt/caddy-l4 \
--with github.com/caddy-dns/cloudflare \
--with clevergo.tech/caddy-dnspodcn \
--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/caddyserver/forwardproxy@caddy2 \
--with github.com/imgk/caddy-trojan \
--with github.com/mholt/caddy-webdav \
--output ./release-tmp/caddy_${version}_${{ matrix.config.name }}
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3
with:
name: caddy-${{ github.sha }}-${{ matrix.config.name }}
path: ./release-tmp/*
- name: Upload to GitHub Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./release-tmp/*
tag: Caddy2
overwrite: true
file_glob: true