Release #77
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version bump type' | |
| required: true | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| jobs: | |
| test: | |
| uses: ./.github/workflows/test-ruby.yml | |
| permissions: | |
| contents: read | |
| version: | |
| name: Calculate Version | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| outputs: | |
| current: ${{ steps.current.outputs.version }} | |
| new: ${{ steps.new.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get current version | |
| id: current | |
| run: | | |
| CURRENT_VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") | |
| CURRENT_VERSION=${CURRENT_VERSION#v} | |
| echo "version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Calculate new version | |
| id: new | |
| run: | | |
| CURRENT="${{ steps.current.outputs.version }}" | |
| IFS='.' read -r -a VERSION_PARTS <<< "$CURRENT" | |
| MAJOR=${VERSION_PARTS[0]} | |
| MINOR=${VERSION_PARTS[1]} | |
| PATCH=${VERSION_PARTS[2]} | |
| case "${{ inputs.version }}" in | |
| major) | |
| NEW_VERSION="$((MAJOR + 1)).0.0" | |
| ;; | |
| minor) | |
| NEW_VERSION="${MAJOR}.$((MINOR + 1)).0" | |
| ;; | |
| patch) | |
| NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))" | |
| ;; | |
| esac | |
| echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT" | |
| docker: | |
| name: Build and Push Docker | |
| needs: version | |
| uses: ./.github/workflows/docker-build.yml | |
| with: | |
| push: true | |
| version: ${{ needs.version.outputs.new }} | |
| secrets: | |
| DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
| FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| attestations: write | |
| id-token: write | |
| release: | |
| name: Create Release | |
| needs: [version, docker] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| 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 and push tag | |
| run: | | |
| git tag -a "v${{ needs.version.outputs.new }}" -m "Release version ${{ needs.version.outputs.new }}" | |
| git push origin "v${{ needs.version.outputs.new }}" | |
| - name: Create release archive | |
| run: | | |
| git archive --format=zip --prefix=play-test-v${{ needs.version.outputs.new }}/ HEAD > play-test-v${{ needs.version.outputs.new }}.zip | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ needs.version.outputs.new }} | |
| name: Release ${{ needs.version.outputs.new }} | |
| body: | | |
| # v${{ needs.version.outputs.new }} | |
| [Read the full changelog here](https://github.com/${{ github.repository }}/compare/v${{ needs.version.outputs.current }}...v${{ needs.version.outputs.new }}) | |
| ## Docker Images | |
| - `${{ vars.DOCKER_USERNAME }}/play-test:v${{ needs.version.outputs.new }}` | |
| - `git.chobble.com/chobble/play-test:v${{ needs.version.outputs.new }}` | |
| - `ghcr.io/${{ github.repository }}:v${{ needs.version.outputs.new }}` | |
| files: | | |
| play-test-v${{ needs.version.outputs.new }}.zip | |
| draft: false | |
| prerelease: false | |
| token: ${{ secrets.GITHUB_TOKEN }} |