Skip to content

Release

Release #12

Workflow file for this run

name: Release
concurrency: release-git
on:
workflow_dispatch: { }
permissions:
contents: read
env:
CARGO_INCREMENTAL: 0
jobs:
test:
name: Test
uses: ./.github/workflows/test.yml
bump:
name: Bump version
needs: [ test ]
runs-on: ubuntu-latest
environment: github
outputs:
commit: ${{ steps.last-commit.outputs.sha }}
changelog: ${{ steps.changelog.outputs.changelog }}
version: ${{ steps.changelog.outputs.version }}
issues-closed: ${{ steps.changelog.outputs.issues-closed }}
steps:
- uses: actions/checkout@v4
name: Checkout
with:
fetch-depth: 0
fetch-tags: true
token: ${{ secrets.GH_TOKEN }}
- name: Git identity
uses: alorel-actions/git-ident@v1
- name: Generate changelog
id: changelog
uses: ./.github/actions/changelog
- name: Init toolchain
uses: alorel-actions/cargo/init@v2
with:
cache-prefix: release
- name: cargo-bump
uses: alorel-actions/cargo/bump@v2
with:
release-type: ${{ steps.changelog.outputs.release-type }}
- name: Commit version bump
run: |
git commit -m "$(cat <<-END
Bump version to ${{ steps.changelog.outputs.version }}
[ci skip]
END
)"
- name: Git tag
run: git tag "${{ steps.changelog.outputs.version }}"
- name: Get last commit sha
id: last-commit
run: echo "sha=$(git log -n 1 --pretty=format:%H)" >> $GITHUB_OUTPUT
- name: Push commit
run: git push
- name: Push tag
run: git push --tags
release-cargo:
name: Release (Cargo)
needs: [ bump ]
runs-on: ubuntu-latest
environment: crates-io
env:
CARGO_INCREMENTAL: 0
steps:
- uses: actions/checkout@v4
name: Checkout
with:
fetch-depth: 1
ref: ${{ needs.bump.outputs.commit }}
- name: Init toolchain
uses: alorel-actions/cargo/init@v2
with:
cache-prefix: release
- name: Publish crate
run: cargo publish --locked --token ${{ secrets.CRATES_IO_TOKEN }}
release-github:
name: Release (GitHub)
needs: [ release-cargo, bump ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
name: Checkout
with:
fetch-depth: 1
ref: ${{ needs.bump.outputs.commit }}
- name: Git identity
uses: alorel-actions/git-ident@v1
- name: Create release
uses: ncipollo/release-action@36e78ab6296394ce36f72f6488e68c2353b50514
with:
allowUpdates: false
prerelease: false
generateReleaseNotes: false
commit: ${{ needs.bump.outputs.commit }}
tag: ${{ needs.bump.outputs.version }}
body: ${{ needs.bump.outputs.changelog }}
notify-issues:
name: Release (Notify)
runs-on: ubuntu-latest
environment: github
needs: [ release-github, bump ]
if: ${{ needs.bump.outputs.issues-closed }}
steps:
- uses: actions/checkout@v4
name: Checkout
with:
fetch-depth: 1
ref: ${{ needs.bump.outputs.commit }}
token: ${{ secrets.GH_TOKEN }}
- name: Git identity
uses: alorel-actions/git-ident@v1
- uses: alorel-actions/semantic-release-lite/notify@v0
with:
tag: ${{ needs.bump.outputs.version }}
issues: ${{ needs.bump.outputs.issues-closed }}
allow-out-of-sync: true
gh-token: ${{ secrets.GH_TOKEN }}