Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add PREVIOUS_REVISION to environment #79

Merged
merged 1 commit into from
Mar 5, 2024

Conversation

janw
Copy link
Contributor

@janw janw commented Jan 26, 2024

This adds the PREVIOUS_REVISION environment variable, allowing subsequent workflow steps to detect if the revision was changed by commitizen.

Example workflow

name: Bump version

on:
  push:
    branches:
      - main

jobs:
  bump-version:
    if: "!startsWith(github.event.head_commit.message, 'bump:')"
    runs-on: ubuntu-latest
    environment: release
    steps:
      - name: Check out
        uses: actions/checkout@v3
        with:
          token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
          fetch-depth: 0

      - name: Import GPG key
        uses: crazy-max/ghaction-import-gpg@v6
        with:
          gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
          passphrase: ${{ secrets.GPG_PASSPHRASE }}

      - name: Create bump and changelog
        uses: commitizen-tools/commitizen-action@master
        with:
          dry_run: true
          github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
          changelog_increment_filename: body.md

      - name: Verify commit signature
        if: env.REVISION != env.PREVIOUS_REVISION
        run: git verify-commit HEAD

      - name: Create GitHub release
        if: env.REVISION != env.PREVIOUS_REVISION
        uses: ncipollo/release-action@v1
        with:
          tag: v${{ env.REVISION }}
          bodyFile: "body.md"
          skipIfReleaseExists: true

Copy link
Member

@noirbizarre noirbizarre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was missing this one too 👌🏼

@woile woile merged commit 5329248 into commitizen-tools:master Mar 5, 2024
1 check failed
@janw janw deleted the add-previous-rev-to-env branch March 7, 2024 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants