|
| 1 | +name: Release-plz |
| 2 | + |
| 3 | +permissions: |
| 4 | + pull-requests: write |
| 5 | + contents: write |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + |
| 12 | +jobs: |
| 13 | + |
| 14 | + # Release unpublished packages. |
| 15 | + release-plz-release: |
| 16 | + name: Release-plz release |
| 17 | + runs-on: ubuntu-latest |
| 18 | + permissions: |
| 19 | + contents: write |
| 20 | + steps: |
| 21 | + - name: Checkout repository |
| 22 | + uses: actions/checkout@v4 |
| 23 | + with: |
| 24 | + fetch-depth: 0 |
| 25 | + - name: Install Rust toolchain |
| 26 | + uses: dtolnay/rust-toolchain@stable |
| 27 | + - name: Run release-plz |
| 28 | + uses: release-plz/action@v0.5 |
| 29 | + with: |
| 30 | + manifest_path: squeeel_cli/Cargo.toml |
| 31 | + command: release |
| 32 | + env: |
| 33 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 34 | + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |
| 35 | + |
| 36 | + # Create a PR with the new versions and changelog, preparing the next release. |
| 37 | + release-plz-pr: |
| 38 | + name: Release-plz PR |
| 39 | + runs-on: ubuntu-latest |
| 40 | + permissions: |
| 41 | + contents: write |
| 42 | + pull-requests: write |
| 43 | + concurrency: |
| 44 | + group: release-plz-${{ github.ref }} |
| 45 | + cancel-in-progress: false |
| 46 | + steps: |
| 47 | + - name: Checkout repository |
| 48 | + uses: actions/checkout@v4 |
| 49 | + with: |
| 50 | + fetch-depth: 0 |
| 51 | + - name: Install Rust toolchain |
| 52 | + uses: dtolnay/rust-toolchain@stable |
| 53 | + - name: Run release-plz |
| 54 | + id: release-plz |
| 55 | + uses: release-plz/action@v0.5 |
| 56 | + with: |
| 57 | + manifest_path: squeeel_cli/Cargo.toml |
| 58 | + command: release-pr |
| 59 | + env: |
| 60 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 61 | + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |
| 62 | + - name: Update README in the release PR |
| 63 | + env: |
| 64 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 65 | + PR: ${{ steps.release-plz.outputs.pr }} |
| 66 | + run: | |
| 67 | + set -e |
| 68 | +
|
| 69 | + new_version=${{ fromJSON(steps.release-plz.outputs.pr).releases[0].version }} |
| 70 | + pr_number=${{ fromJSON(steps.release-plz.outputs.pr).number }} |
| 71 | + if [[ -n "$pr_number" ]]; then |
| 72 | + gh pr checkout $pr_number |
| 73 | + cd npm-package |
| 74 | + npm config set version=$new_version |
| 75 | + git add . |
| 76 | + git commit -m "Update npm-package version" |
| 77 | + git push |
| 78 | + fi |
0 commit comments