diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml new file mode 100644 index 0000000..76de3a0 --- /dev/null +++ b/.github/workflows/bump.yml @@ -0,0 +1,41 @@ +name: bump + +on: + pull_request_target: + types: + - closed + +permissions: + contents: write # needed for pushing tags/commits + +jobs: + bump: + # Only run if PR was merged AND has the bump label + if: > + github.event.pull_request.merged == true && + contains(github.event.pull_request.labels.*.name, 'bump:patch') + + runs-on: ubuntu-latest + + steps: + # We check out the BASE branch — this is now the merged code — SAFE + - name: Checkout merged code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.base.ref }} + fetch-depth: 0 + + # Environment + - name: Set up Pixi + uses: prefix-dev/setup-pixi@v0.8.9 + + # Git identity + - name: Set Git identity + run: | + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + + # Bump version + - name: Bump version (patch) + run: | + pixi run bumpver update --patch \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 32ff2b1..d02bede 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,54 +1,13 @@ name: release -on: - pull_request_target: - types: - - closed - -permissions: - contents: write # needed for pushing tags/commits & creating releases +on: push jobs: release: - # Only run if PR was merged AND has the bump label - if: > - github.event.pull_request.merged == true && - contains(github.event.pull_request.labels.*.name, 'bump:patch') - runs-on: ubuntu-latest - steps: - # We check out the BASE branch — this is now the merged code — SAFE - - name: Checkout merged code - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.base.ref }} - fetch-depth: 0 - - # Environment - - name: Set up Pixi - uses: prefix-dev/setup-pixi@v0.8.9 - - # Git identity - - name: Set Git identity - run: | - git config user.name 'github-actions[bot]' - git config user.email 'github-actions[bot]@users.noreply.github.com' - - # Bump version - - name: Bump version (patch) - run: | - pixi run bumpver update --patch - - - name: Get version tag - id: version - run: echo "value=$(pixi run current-version)" >> $GITHUB_OUTPUT - - # Create GitHub Release - - name: Create Release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.version.outputs.value }} - release_name: "Release ${{ steps.version.outputs.value }}" \ No newline at end of file + - name: Checkout + uses: actions/checkout@v5 + - name: Release + uses: softprops/action-gh-release@v2 + if: github.ref_type == 'tag' \ No newline at end of file