Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/doc-assert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
name: lint, build & test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Format
run: cargo fmt --all -- --check
- name: Lint
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Copyright 2024 The DocAssert Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Publishes the crate to crates.io when a version tag (e.g. v0.1.2) is pushed.
# Authentication uses crates.io Trusted Publishing (OIDC), so no long-lived
# API token is stored in the repository.

name: Release

on:
push:
tags: [ "v*" ]

env:
CARGO_TERM_COLOR: always

jobs:
publish:
name: publish to crates.io
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Check tag matches Cargo.toml version
run: |
version=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "doc-assert") | .version')
if [ "v$version" != "$GITHUB_REF_NAME" ]; then
echo "Tag $GITHUB_REF_NAME does not match Cargo.toml version v$version"
exit 1
fi
- name: Format
run: cargo fmt --all -- --check
- name: Lint
run: cargo clippy -- -D warnings
- name: Build
run: cargo build --verbose --features="binary"
- name: Run tests
run: cargo test --verbose --workspace
- name: Start sample-api backend
working-directory: ./tests/functional
run: make backend-start
- name: Wait for sample-api backend
working-directory: ./tests/functional
run: make backend-wait
- name: Run sanity functional tests
working-directory: ./tests/functional
run: make sanity
- name: Authenticate with crates.io
uses: rust-lang/crates-io-auth-action@v1
id: auth
- name: Publish
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
Loading