Skip to content

Commit d62c80d

Browse files
committed
Add build workflow
1 parent 8563441 commit d62c80d

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/build.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build
2+
on:
3+
push:
4+
branches: [naive]
5+
paths-ignore: [README.md]
6+
release:
7+
types: [published]
8+
defaults:
9+
run:
10+
shell: bash
11+
jobs:
12+
build_caddy_with_naive:
13+
runs-on: ubuntu-22.04
14+
env:
15+
BUNDLE: caddy-forwardproxy-naive
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-go@v5
19+
with:
20+
go-version: ^1.21.9
21+
- run: go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
22+
- run: ~/go/bin/xcaddy build --with github.com/caddyserver/forwardproxy@master=$PWD
23+
- name: Pack naiveproxy assets
24+
run: |
25+
mkdir ${{ env.BUNDLE }}
26+
cp caddy LICENSE README.md ${{ env.BUNDLE }}
27+
tar cJf ${{ env.BUNDLE }}.tar.xz ${{ env.BUNDLE }}
28+
openssl sha256 ./caddy >sha256sum.txt
29+
echo "SHA256SUM=$(cut -d' ' -f2 sha256sum.txt)" >>$GITHUB_ENV
30+
- uses: actions/upload-artifact@v4
31+
with:
32+
name: ${{ env.BUNDLE }}.tar.xz caddy executable sha256 ${{ env.SHA256SUM }}
33+
path: sha256sum.txt
34+
- name: Upload caddy assets
35+
if: ${{ github.event_name == 'release' }}
36+
run: gh release upload "${GITHUB_REF##*/}" ${{ env.BUNDLE }}.tar.xz --clobber
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)