| 1 | --- |
| 2 | name: Deploy |
| 3 | |
| 4 | on: |
| 5 | push: |
| 6 | tags: |
| 7 | - '*' |
| 8 | workflow_dispatch: |
| 9 | |
| 10 | permissions: |
| 11 | contents: write |
| 12 | |
| 13 | jobs: |
| 14 | test: |
| 15 | uses: ./.github/workflows/test.yml |
| 16 | |
| 17 | release: |
| 18 | name: Create Release |
| 19 | runs-on: ubuntu-latest |
| 20 | needs: test |
| 21 | steps: |
| 22 | - name: Checkout sources |
| 23 | uses: actions/checkout@v6 |
| 24 | |
| 25 | - name: Get the release version from the tag |
| 26 | run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV |
| 27 | |
| 28 | - name: Create Release |
| 29 | uses: softprops/action-gh-release@v2 |
| 30 | with: |
| 31 | name: Release ${{ env.VERSION }} |
| 32 | draft: false |
| 33 | prerelease: false |
| 34 | generate_release_notes: true |
| 35 | |
| 36 | publish: |
| 37 | name: Publish to crates.io |
| 38 | runs-on: ubuntu-latest |
| 39 | needs: test |
| 40 | steps: |
| 41 | - name: Checkout sources |
| 42 | uses: actions/checkout@v6 |
| 43 | |
| 44 | - name: Install Rust |
| 45 | uses: dtolnay/rust-toolchain@stable |
| 46 | |
| 47 | - run: cargo publish --token ${CRATES_TOKEN} |
| 48 | env: |
| 49 | CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} |