diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..ae86d55 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,40 @@ +name: Release + +on: + push: + branches: [ main ] + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Configure git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Create tag + id: tag + run: | + LAST_TAG=$(git describe --tags --match "v[0-9]*.[0-9]*.[0-9]*" --abbrev=0 2>/dev/null || echo "v0.0.0") + VERSION=${LAST_TAG#v} + IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION" + PATCH=$((PATCH + 1)) + TAG="v${MAJOR}.${MINOR}.${PATCH}" + echo "tag=$TAG" >> "$GITHUB_OUTPUT" + git tag -a "$TAG" -m "Release $TAG" + git push origin "$TAG" + + - name: Create release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.tag.outputs.tag }} + name: Release ${{ steps.tag.outputs.tag }} + generate_release_notes: true