|
| 1 | +name: Release Upgradeable |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: {} |
| 5 | + |
| 6 | +env: |
| 7 | + UPGRADEABLE_REPO: OpenZeppelin/openzeppelin-contracts-upgradeable |
| 8 | + |
| 9 | +jobs: |
| 10 | + state: |
| 11 | + name: Check state |
| 12 | + permissions: |
| 13 | + pull-requests: read |
| 14 | + if: ${{ github.repository == 'OpenZeppelin/openzeppelin-contracts' }} |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v6 |
| 18 | + with: |
| 19 | + repository: ${{ env.UPGRADEABLE_REPO }} |
| 20 | + ref: ${{ github.ref }} |
| 21 | + - uses: actions/checkout@v6 |
| 22 | + with: |
| 23 | + ref: ${{ github.ref }} |
| 24 | + path: lib/openzeppelin-contracts |
| 25 | + - name: Set up environment |
| 26 | + uses: ./.github/actions/setup |
| 27 | + - name: Get reference commit |
| 28 | + id: get-reference-commit |
| 29 | + run: | |
| 30 | + cd lib/openzeppelin-contracts |
| 31 | + echo "commit=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" |
| 32 | + - name: Check upgradeable |
| 33 | + id: check-upgradeable |
| 34 | + run: bash lib/openzeppelin/scripts/release/workflow/check-upgradeable.sh # TODO: remove path prefix when this is merged and the change are transpiled |
| 35 | + env: |
| 36 | + REFERENCE_COMMIT: ${{ steps.get-reference-commit.outputs.commit }} |
| 37 | + outputs: |
| 38 | + publish: ${{ steps.check-upgradeable.outcome }} |
| 39 | + is_prerelease: ${{ steps.check-upgradeable.outputs.is_prerelease }} |
| 40 | + |
| 41 | + # copied from release-cycle.yml |
| 42 | + publish: |
| 43 | + needs: state |
| 44 | + name: Publish to npm |
| 45 | + environment: npm |
| 46 | + permissions: |
| 47 | + contents: write |
| 48 | + id-token: write |
| 49 | + if: needs.state.outputs.publish == 'success' # Note: changed from 'true' to 'success' to support the way publish is computed |
| 50 | + runs-on: ubuntu-latest |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v6 |
| 53 | + with: |
| 54 | + repository: ${{ env.UPGRADEABLE_REPO }} |
| 55 | + ref: ${{ github.ref }} |
| 56 | + - uses: actions/checkout@v6 |
| 57 | + with: |
| 58 | + ref: ${{ github.ref }} |
| 59 | + path: lib/openzeppelin-contracts |
| 60 | + - name: Set up environment |
| 61 | + uses: ./.github/actions/setup |
| 62 | + - id: pack |
| 63 | + name: Pack |
| 64 | + run: bash scripts/release/workflow/pack.sh |
| 65 | + env: |
| 66 | + PRERELEASE: ${{ needs.state.outputs.is_prerelease }} |
| 67 | + - name: Upload tarball artifact |
| 68 | + uses: actions/upload-artifact@v5 |
| 69 | + with: |
| 70 | + name: ${{ github.ref_name }} |
| 71 | + path: ${{ steps.pack.outputs.tarball }} |
| 72 | + - name: Publish |
| 73 | + run: bash scripts/release/workflow/publish.sh |
| 74 | + env: |
| 75 | + TARBALL: ${{ steps.pack.outputs.tarball }} |
| 76 | + TAG: ${{ steps.pack.outputs.tag }} |
| 77 | + - name: Create Github Release |
| 78 | + uses: actions/github-script@v8 |
| 79 | + env: |
| 80 | + PRERELEASE: ${{ needs.state.outputs.is_prerelease }} |
| 81 | + with: |
| 82 | + github-token: ${{ secrets.GH_TOKEN_UPGRADEABLE }} |
| 83 | + script: await require('./lib/openzeppelin-contracts/scripts/release/workflow/github-release.js')({ github, context }, '${{ env.UPGRADEABLE_REPO }}') # TODO: remove path prefix when this is merged and the change are transpiled |
| 84 | + outputs: |
| 85 | + tarball_name: ${{ steps.pack.outputs.tarball_name }} |
| 86 | + |
| 87 | + integrity_check: |
| 88 | + needs: publish |
| 89 | + name: Tarball Integrity Check |
| 90 | + runs-on: ubuntu-latest |
| 91 | + steps: |
| 92 | + - uses: actions/checkout@v6 |
| 93 | + - name: Download tarball artifact |
| 94 | + id: artifact |
| 95 | + uses: actions/download-artifact@v6 |
| 96 | + with: |
| 97 | + name: ${{ github.ref_name }} |
| 98 | + - name: Check integrity |
| 99 | + run: bash scripts/release/workflow/integrity-check.sh |
| 100 | + env: |
| 101 | + TARBALL: ${{ steps.artifact.outputs.download-path }}/${{ needs.publish.outputs.tarball_name }} |
0 commit comments