Skip to content

Commit

Permalink
Update caddy.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
smxl authored Oct 13, 2024
1 parent 8112bfb commit f7a7a41
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions .github/workflows/caddy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,36 @@ jobs:
arch: [amd64, arm64] # 支持多架构的构建

steps:
# Setup Go environment
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
check-latest: true

# Check if go.mod exists, if not, initialize go module
- name: Initialize Go module
run: |
if [ ! -f go.mod ]; then
go mod init github.com/yourrepo/yourproject
go mod init github.com/${{ github.repository }}
fi
# Generate go.sum
- name: Generate go.sum
run: go mod tidy

# Install xcaddy
- name: Install xcaddy
run: go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest

# Build Caddy with plugins
- name: Build Caddy with plugins
run: |
CaddyVer=$(curl -s "https://api.github.com/repos/caddyserver/caddy/releases/latest" | jq -r .tag_name)
echo "CaddyVer=${CaddyVer}" >> $GITHUB_ENV
xcaddy build latest \
xcaddy build ${CaddyVer} \
--with github.com/imgk/caddy-trojan \
--with github.com/caddyserver/forwardproxy@caddy2=github.com/klzgrad/forwardproxy@naive \
--output caddy_linux-${{ matrix.arch }}
zstd -k -19 caddy_linux-${{ matrix.arch }} -o caddy_linux-${{ matrix.arch }}.zst
# Upload built artifacts
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
Expand All @@ -59,20 +56,22 @@ jobs:

release:
runs-on: ubuntu-latest
needs: build # 确保发布任务依赖于构建任务完成
needs: build
steps:
# 下载工件,确保名称与上传一致
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

# 上传 release 到 GitHub
- name: Get current date
id: date
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT

- name: Upload release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
tag: main-${{ steps.date.outputs.DATE }}
body: Caddy ${{ env.CaddyVer }} with Trojan and Forwardproxy
file: artifacts/caddy-*/caddy_linux-*.zst
overwrite: true
Expand Down

0 comments on commit f7a7a41

Please sign in to comment.