hsa-app/.forgejo/workflows/build.yml
Jean-Michel Tremblay fafd763d99
All checks were successful
Build and Test / build-and-test (push) Successful in 34s
Split deploy: auto-stage on tag, manual activate via button
build.yml now only stages the binary into ~/hsa-app/releases on tag
(no symlink swap or restart). Activation is a separate workflow_dispatch
workflow (deploy.yml) the user triggers from the Forgejo Actions tab,
passing the tag to point the symlink at and restart. Update INSTALL.md
to describe the stage/activate split.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 15:12:22 -04:00

30 lines
1.2 KiB
YAML

name: Build and Test
on: [push]
jobs:
build-and-test:
runs-on: shell
steps:
- name: Checkout
run: |
git clone --branch ${{ github.ref_name }} ${{ github.server_url }}/${{ github.repository }}.git .
- name: Test
run: docker run --rm -w /src -v $PWD:/src golang:1.26 go test ./...
- name: Build
run: docker run --rm -w /src -v $PWD:/src -e CGO_ENABLED=0 golang:1.26 go build -buildvcs=false -ldflags "-s -w" -o hsa ./cmd/hsa
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: hsa
path: hsa
- name: Stage release
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "${{ secrets.FORGEJO_SSH }}" > /tmp/deploy_key
chmod 600 /tmp/deploy_key
TAG=${{ github.ref_name }}
REL=hsa-app/releases/hsa-app-V$TAG
TARGET=${{ vars.HSA_APP_USER }}@${{ vars.HSA_APP_HOST }}
ssh -i /tmp/deploy_key -o StrictHostKeyChecking=no $TARGET "mkdir -p $REL"
scp -i /tmp/deploy_key -o StrictHostKeyChecking=no hsa $TARGET:$REL/hsa
ssh -i /tmp/deploy_key -o StrictHostKeyChecking=no $TARGET "chmod +x $REL/hsa"
rm /tmp/deploy_key