From a091e89e8ac4ce75ced4510838b9b8e3f0bc943d Mon Sep 17 00:00:00 2001 From: SNEK WAIFU Date: Thu, 14 May 2026 04:42:44 +0700 Subject: [PATCH] auto release --- .github/workflows/release.yml | 56 +++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..fb003ed --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +name: Release + +on: + push: + branches: [master] + +permissions: + contents: write + pull-requests: read + +concurrency: + group: release-${{ github.ref }} + cancel-in-progress: true + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 + with: + persist-credentials: false + fetch-depth: 0 + + - name: Set release metadata + id: meta + shell: bash + run: | + VERSION="$(jq -r .version package.json)" + TAG="v${VERSION}" + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "tag=${TAG}" >> "$GITHUB_OUTPUT" + + - name: Check if tag already exists + id: tag_check + shell: bash + run: | + if git ls-remote --tags origin "refs/tags/${{ steps.meta.outputs.tag }}" | grep -q "${{ steps.meta.outputs.tag }}"; then + echo "exists=true" >> "$GITHUB_OUTPUT" + else + echo "exists=false" >> "$GITHUB_OUTPUT" + fi + + - name: Create GitHub release + if: steps.tag_check.outputs.exists == 'false' + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.meta.outputs.tag }} + name: ${{ steps.meta.outputs.tag }} + target_commitish: master + generate_release_notes: true + + - name: Skip release when tag exists + if: steps.tag_check.outputs.exists == 'true' + run: echo "Tag ${{ steps.meta.outputs.tag }} already exists. Skipping release creation." \ No newline at end of file