134 lines
4.3 KiB
YAML
134 lines
4.3 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*.*.*'
|
|
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
|
|
jobs:
|
|
build-frontend:
|
|
name: Build Frontend
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
|
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
|
with:
|
|
node-version: '20.19.5'
|
|
cache: 'npm'
|
|
cache-dependency-path: frontend/package-lock.json
|
|
|
|
- name: Install Dependencies
|
|
working-directory: frontend
|
|
run: npm ci
|
|
|
|
- name: Build
|
|
working-directory: frontend
|
|
run: npm run build
|
|
|
|
- name: Archive Frontend
|
|
working-directory: frontend
|
|
run: tar -czf ../frontend-dist.tar.gz dist/
|
|
|
|
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
name: frontend-dist
|
|
path: frontend-dist.tar.gz
|
|
|
|
build-backend:
|
|
name: Build Backend
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
goos: [linux]
|
|
goarch: [amd64, arm64]
|
|
steps:
|
|
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
|
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
|
|
with:
|
|
go-version: '1.25.4'
|
|
|
|
- name: Build
|
|
working-directory: backend
|
|
env:
|
|
GOOS: ${{ matrix.goos }}
|
|
GOARCH: ${{ matrix.goarch }}
|
|
CGO_ENABLED: 1
|
|
run: |
|
|
# Install dependencies for CGO (sqlite)
|
|
if [ "${{ matrix.goarch }}" = "arm64" ]; then
|
|
sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
|
|
export CC=aarch64-linux-gnu-gcc
|
|
fi
|
|
|
|
go build -ldflags "-s -w -X github.com/Wikid82/CaddyProxyManagerPlus/backend/internal/version.Version=${{ github.ref_name }}" -o ../cpmp-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/api
|
|
|
|
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
name: backend-${{ matrix.goos }}-${{ matrix.goarch }}
|
|
path: cpmp-${{ matrix.goos }}-${{ matrix.goarch }}
|
|
|
|
build-caddy:
|
|
name: Build Caddy
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
goos: [linux]
|
|
goarch: [amd64, arm64]
|
|
steps:
|
|
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
|
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
|
|
with:
|
|
go-version: '1.25.4'
|
|
|
|
- name: Install xcaddy
|
|
run: go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
|
|
|
|
- name: Build Caddy
|
|
env:
|
|
GOOS: ${{ matrix.goos }}
|
|
GOARCH: ${{ matrix.goarch }}
|
|
run: |
|
|
xcaddy build v2.9.1 \
|
|
--replace github.com/quic-go/quic-go=github.com/quic-go/quic-go@v0.49.1 \
|
|
--replace golang.org/x/crypto=golang.org/x/crypto@v0.35.0 \
|
|
--output caddy-${{ matrix.goos }}-${{ matrix.goarch }}
|
|
|
|
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
name: caddy-${{ matrix.goos }}-${{ matrix.goarch }}
|
|
path: caddy-${{ matrix.goos }}-${{ matrix.goarch }}
|
|
|
|
create-release:
|
|
name: Create Release
|
|
needs: [build-frontend, build-backend, build-caddy]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: Display structure of downloaded files
|
|
run: ls -R artifacts
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@5be0e66d93ac7ed76da52eca8bb058f665c3a5fe # v2.4.2
|
|
with:
|
|
files: |
|
|
artifacts/frontend-dist/frontend-dist.tar.gz
|
|
artifacts/backend-linux-amd64/cpmp-linux-amd64
|
|
artifacts/backend-linux-arm64/cpmp-linux-arm64
|
|
artifacts/caddy-linux-amd64/caddy-linux-amd64
|
|
artifacts/caddy-linux-arm64/caddy-linux-arm64
|
|
generate_release_notes: true
|
|
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
|
|
token: ${{ secrets.CPMP_TOKEN }}
|
|
|
|
build-and-publish:
|
|
needs: create-release
|
|
uses: ./.github/workflows/docker-publish.yml # Reusable workflow present; path validated
|
|
secrets: inherit
|