name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -Dwarnings
jobs:
release:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17-alpine
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: a3s_orm
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d a3s_orm"
--health-interval 5s
--health-timeout 5s
--health-retries 10
env:
A3S_ORM_POSTGRES_URL: postgres://postgres:postgres@127.0.0.1:5432/a3s_orm
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- name: Verify tag matches crate version
shell: bash
run: |
version="$(sed -n 's/^version = "\([^"]*\)"/\1/p' Cargo.toml | head -1)"
test "${GITHUB_REF_NAME}" = "v${version}"
- run: cargo fmt --all -- --check
- run: cargo test --all-features
- run: cargo clippy --all-targets --all-features -- -D warnings
- run: cargo package --locked
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: >-
gh release create "${GITHUB_REF_NAME}"
"target/package/a3s-orm-${GITHUB_REF_NAME#v}.crate"
--title "a3s-orm ${GITHUB_REF_NAME}"
--generate-notes
--verify-tag