rust cache in release #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version to publish (e.g., 0.1.0)" | |
| required: true | |
| type: string | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| publish: | |
| name: Publish to crates.io | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache dependencies | |
| uses: swatinem/rust-cache@v2 | |
| - name: Install cargo-workspaces | |
| run: cargo install cargo-workspaces | |
| - name: Check that workspace builds | |
| run: cargo build --release --verbose | |
| - name: Run tests | |
| run: cargo test --release --verbose | |
| - name: Login to crates.io | |
| run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| - name: Dry run publish (check only) | |
| run: cargo workspaces publish --dry-run --yes --no-git-commit | |
| - name: Publish to crates.io | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| run: cargo workspaces publish --yes --no-git-commit | |
| create-release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: publish | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get version from tag | |
| id: get_version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref }} | |
| release_name: Release v${{ steps.get_version.outputs.VERSION }} | |
| body: | | |
| ## Changes in v${{ steps.get_version.outputs.VERSION }} | |
| ### Crates Published | |
| - address-book v${{ steps.get_version.outputs.VERSION }} | |
| - anchor-utils v${{ steps.get_version.outputs.VERSION }} | |
| - testsvm v${{ steps.get_version.outputs.VERSION }} | |
| - testsvm-quarry v${{ steps.get_version.outputs.VERSION }} | |
| ### Installation | |
| ```toml | |
| [dependencies] | |
| testsvm = "${{ steps.get_version.outputs.VERSION }}" | |
| ``` | |
| See the [CHANGELOG](https://github.com/macalinao/testsvm/blob/main/CHANGELOG.md) for details. | |
| draft: false | |
| prerelease: false |