name: Release
on:
push:
branches:
- "main"
permissions:
contents: write
jobs:
qa:
name: QA (${{ matrix.image-tag }})
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
image-tag: [latest, preview]
env:
EVENTSOURCINGDB_IMAGE_TAG: ${{ matrix.image-tag }}
steps:
- name: Clone repository
uses: actions/checkout@v7.0.1
- name: Use Rust
uses: actions-rust-lang/setup-rust-toolchain@v2.0.0
with:
toolchain: stable
components: clippy, rustfmt
cache: false
build-warnings: ""
- name: Run QA
run: make qa
release:
name: Release
needs: qa
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Clone repository
uses: actions/checkout@v7.0.1
with:
fetch-depth: "0"
token: ${{ secrets.TOKEN_GITHUB_TO_GITHUB_REPOSITORIES_RW }}
- name: Use Rust
uses: actions-rust-lang/setup-rust-toolchain@v2.0.0
with:
toolchain: stable
components: clippy, rustfmt
cache: false
build-warnings: ""
- name: Get next version
id: get_next_version
uses: thenativeweb/get-next-version@2.8.3
- name: Create new version
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
run: |
cargo install cargo-edit
# Both crates share the version, and architecturekit requires exactly
# its own version of architecturekit-macros, which this updates too.
cargo set-version --workspace ${{ steps.get_next_version.outputs.version }}
git config --global user.email "hello@thenativeweb.io"
git config --global user.name "${{ github.actor }}"
git add .
git commit -m 'chore: Bump version to ${{ steps.get_next_version.outputs.version }}. [skip ci]'
git push
git tag v${{steps.get_next_version.outputs.version}}
git push origin v${{steps.get_next_version.outputs.version}}
- name: Build artifacts
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
run: |
cargo build
- name: Publish new version
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
run: |
echo "${{ secrets.TOKEN_GITHUB_TO_CRATES_RW }}" | cargo login
# architecturekit depends on architecturekit-macros, so the macros
# have to be on crates.io first.
cargo publish --package architecturekit-macros
cargo publish --package architecturekit