Skip to content

ci: remove legacy workflows (#38) #2

ci: remove legacy workflows (#38)

ci: remove legacy workflows (#38) #2

Workflow file for this run

name: Release
on:
push:
branches: [main]
workflow_dispatch:
jobs:
release:
name: Create GitHub Release
runs-on: ubuntu-latest
outputs:
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
output=$(npx -p semantic-release \
-p @semantic-release/changelog \
-p @semantic-release/git \
-p @semantic-release/github \
-p conventional-changelog-conventionalcommits \
semantic-release 2>&1) && exit_code=0 || exit_code=$?
echo "$output"
if echo "$output" | grep -q "Published release"; then
echo "new_release_published=true" >> "$GITHUB_OUTPUT"
else
echo "new_release_published=false" >> "$GITHUB_OUTPUT"
fi
exit $exit_code
publish:
name: Publish to crates.io
needs: release
if: needs.release.outputs.new_release_published == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
- name: Cache target directory
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }}
- name: Run tests
run: cargo test --all-features
continue-on-error: true
- name: Build release
run: cargo build --release
- name: Publish to crates.io
uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: rust-artifacts
path: target/release/