From a8bc6ef2dc6ac6317d162ccaca200a9e960abcb7 Mon Sep 17 00:00:00 2001 From: Firas al-Khalil Date: Wed, 6 Nov 2024 10:53:01 +0100 Subject: [PATCH] cd: release on tag only --- .github/workflows/cd.yml | 47 ++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 1a66538..4177704 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -33,7 +33,7 @@ jobs: chmod +x tsdl - name: Build run: | - ./tsdl build --out-dir lib/${{ matrix.platform}} + ./tsdl build --out-dir lib/${{ matrix.platform }} - name: Prepare git # To get tags from `git describe` run: | git fetch --prune --unshallow @@ -44,13 +44,46 @@ jobs: - name: Make zip and tar run: | ./package/zip + - name: Copy parsers.toml + run: | + cp parsers.toml lib/parsers.toml + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: build-artifacts-${{ matrix.os }}-${{ matrix.platform }} + path: | + lib/*.deb + lib/*.gz + lib/*.toml + lib/*.zip + + release: + if: startsWith(github.ref, 'refs/tags/') + needs: build + + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: build-artifacts + path: artifacts + + - name: Get tag name + run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + - name: Release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ steps.vars.outputs.sha_short }} - name: Release ${{ github.ref }}-${{ steps.vars.outputs.sha_short }} - draft: true + name: Release ${{ env.TAG_NAME }}-${{ steps.vars.outputs.sha_short }} + draft: false files: | - ./lib/* - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + artifacts/**