fix: handle immutable releases (#21) #16
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 Please | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| release_tag: ${{ steps.release.outputs.tag_name }} | |
| steps: | |
| - uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0 | |
| id: release | |
| - name: Checkout | |
| if: ${{ steps.release.outputs.release_created }} | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Ninja | |
| if: ${{ steps.release.outputs.release_created }} | |
| run: sudo apt-get install ninja-build | |
| - name: Build singleheader | |
| if: ${{ steps.release.outputs.release_created }} | |
| run: | | |
| cmake -DMERVE_TESTING=OFF -G Ninja -B build | |
| cmake --build build --target merve-singleheader-lib | |
| - name: Create singleheader.zip | |
| if: ${{ steps.release.outputs.release_created }} | |
| run: | | |
| cd build/singleheader | |
| zip singleheader.zip merve.h merve.cpp merve_c.h | |
| mv singleheader.zip ../../singleheader/ | |
| cp merve.h merve.cpp merve_c.h ../../singleheader/ | |
| - name: Upload release assets | |
| if: ${{ steps.release.outputs.release_created }} | |
| run: gh release upload "$RELEASE_TAG" singleheader/* | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| RELEASE_TAG: ${{ steps.release.outputs.tag_name }} | |
| - name: Publish release | |
| if: ${{ steps.release.outputs.release_created }} | |
| run: gh release edit "$RELEASE_TAG" --draft=false | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| RELEASE_TAG: ${{ steps.release.outputs.tag_name }} | |
| publish-rust: | |
| needs: release-please | |
| if: ${{ needs.release-please.outputs.release_created }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| - name: Build and test (populates rust/deps from source) | |
| working-directory: rust | |
| run: cargo test | |
| - name: Commit rust/deps if changed | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add rust/deps/ | |
| if git diff --cached --quiet; then | |
| echo "rust/deps is up to date" | |
| else | |
| git commit -m "chore: update rust/deps vendored sources" | |
| git push | |
| fi | |
| - name: Publish to crates.io | |
| working-directory: rust | |
| run: cargo publish | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |