From 618263a5d018f8f98053a4a4d977009b7f36922d Mon Sep 17 00:00:00 2001 From: Xboard <147830212+cedar2025@users.noreply.github.com> Date: Thu, 19 Mar 2026 02:15:16 +0800 Subject: [PATCH] Enhance CI workflow for versioning and release handling Updated CI workflow to include versioning and handle releases for both tags and the dev branch. --- .github/workflows/ci.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0f7aed..e7ad4dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,6 +47,8 @@ jobs: cache: true - name: Build + env: + VERSION: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || github.sha }} run: | if [ "${{ matrix.goarch }}" = "amd64" ]; then make build-linux @@ -92,25 +94,27 @@ jobs: tags: | ghcr.io/cedar2025/xboard-node:latest ghcr.io/cedar2025/xboard-node:${{ github.sha }} + ${{ startsWith(github.ref, 'refs/tags/') && format('ghcr.io/cedar2025/xboard-node:{0}', github.ref_name) || '' }} release: name: Release runs-on: ubuntu-latest needs: build - if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/dev' + permissions: + contents: write steps: - uses: actions/checkout@v4 - name: Download all artifacts uses: actions/download-artifact@v4 with: merge-multiple: true + path: dist - name: Release uses: softprops/action-gh-release@v2 with: + tag_name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'dev' }} + make_latest: ${{ startsWith(github.ref, 'refs/tags/') }} files: | - xboard-node-linux-amd64 - xboard-node-linux-arm64 - draft: false - prerelease: false - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + dist/xboard-node-linux-amd64 + dist/xboard-node-linux-arm64