name: Release-plz on: push: branches: - main workflow_dispatch: jobs: release-plz-release: name: Release-plz release runs-on: ubuntu-latest if: github.repository_owner == 'arcuru' && (github.event_name == 'push' || github.ref == 'refs/heads/main') environment: publish permissions: actions: write contents: write id-token: write steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master with: toolchain: stable - name: Rust Cache uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 - name: Authenticate with crates.io uses: rust-lang/crates-io-auth-action@bbd81622f20ce9e2dd9622e3218b975523e45bbe # v1.0.4 id: cratesio-auth - name: Run release-plz id: release-plz uses: release-plz/action@1528104d2ca23787631a1c1f022abb64b34c1e11 # v0.5.128 with: command: release config: .config/release-plz.toml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CARGO_REGISTRY_TOKEN: ${{ steps.cratesio-auth.outputs.token }} - name: Trigger publish workflow if: steps.release-plz.outputs.releases_created == 'true' env: RELEASES: ${{ steps.release-plz.outputs.releases }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | TAG=$(echo "$RELEASES" | jq -r '.[0].tag_name') gh workflow run publish.yml -f tag_name="$TAG" release-plz-pr: name: Release-plz PR runs-on: ubuntu-latest if: ${{ github.repository_owner == 'arcuru' }} permissions: contents: write pull-requests: write concurrency: group: release-plz-${{ github.ref }} cancel-in-progress: false steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master with: toolchain: stable - name: Rust Cache uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 - name: Check if release PR exists id: check-pr if: github.event_name == 'push' run: | PR_EXISTS=$(gh pr list --repo "$GITHUB_REPOSITORY" --state open --json number,headRefName --jq '[.[] | select(.headRefName | startswith("release-plz"))] | length') echo "exists=$PR_EXISTS" >> "$GITHUB_OUTPUT" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run release-plz if: github.event_name == 'workflow_dispatch' || steps.check-pr.outputs.exists != '0' uses: release-plz/action@1528104d2ca23787631a1c1f022abb64b34c1e11 # v0.5.128 with: command: release-pr config: .config/release-plz.toml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}