|
6 | 6 | jobs: |
7 | 7 | release-upgradeable: |
8 | 8 | environment: push-upgradeable |
| 9 | + permissions: |
| 10 | + id-token: write # Required for OIDC |
| 11 | + contents: read |
9 | 12 | runs-on: ubuntu-latest |
10 | 13 | env: |
11 | 14 | VANILLA_REPO: OpenZeppelin/openzeppelin-contracts |
12 | 15 | UPGRADEABLE_REPO: james-toussaint/openzeppelin-contracts-upgradeable # TODO: Update repo before merging |
13 | 16 | steps: |
| 17 | + - run: echo "UPGRADEABLE_DIR=${GITHUB_WORKSPACE}/upgradeable" >> "$GITHUB_ENV" |
14 | 18 | - uses: actions/checkout@v5 |
15 | 19 | with: |
16 | 20 | repository: ${{ env.VANILLA_REPO }} |
17 | 21 | ref: ${{ github.ref }} |
18 | | - - name: Get vanilla commit |
19 | | - run: | |
20 | | - echo "VANILLA_COMMIT=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV" |
| 22 | + - id: vanilla |
| 23 | + name: Get vanilla commit |
| 24 | + run: echo "commit=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" |
| 25 | + - uses: actions/checkout@v5 # TODO: Remove this before merging (used to get node 24.x from setup action) |
| 26 | + - name: Set up environment |
| 27 | + uses: ./.github/actions/setup |
21 | 28 | - uses: actions/checkout@v5 |
22 | 29 | with: |
23 | 30 | repository: ${{ env.UPGRADEABLE_REPO }} |
24 | 31 | submodules: true |
25 | 32 | token: ${{ secrets.GH_TOKEN_UPGRADEABLE }} |
26 | 33 | ref: ${{ github.ref }} |
27 | | - - name: Run |
28 | | - run: | |
29 | | - if ! git log -1 --pretty=%B | grep -q "Transpile ${VANILLA_COMMIT}"; then |
30 | | - echo "Expected 'Transpile ${VANILLA_COMMIT}' but found '$(git log -1 --pretty=%B)'" |
31 | | - exit 1 |
32 | | - fi |
33 | | - VERSION="$(jq -r .version contracts/package.json)" |
34 | | - GIT_TAG="v${VERSION}" |
35 | | - NPM_TAG="tmp" |
36 | | - ADDITIONAL_OPTION_IF_PRERELEASE="--prerelease" |
37 | | - if [[ "${GIT_TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
38 | | - NPM_TAG="dev" |
39 | | - ADDITIONAL_OPTION_IF_PRERELEASE="" |
40 | | - elif [[ "${GIT_TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-rc.[0-9]+$ ]]; then |
41 | | - NPM_TAG="next" |
42 | | - fi |
43 | | - echo "ADDITIONAL_OPTION_IF_PRERELEASE=${ADDITIONAL_OPTION_IF_PRERELEASE}" >> "$GITHUB_ENV" |
44 | | - ### [START BLOCK] TODO: Remove block before merging |
45 | | - TIMESTAMPED_VERSION="${VERSION}-$(date +%s)" |
46 | | - echo "OLD_GIT_TAG=${GIT_TAG}" >> "$GITHUB_ENV" |
47 | | - GIT_TAG="${GIT_TAG}-$(date +%s)" # incremental git tag for testing |
48 | | - sed -i'' -e 's/openzeppelin\/contracts-upgradeable/james-toussaint\/contracts-upgradeable/g' contracts/package.json # custom scope for testing |
49 | | - sed -i'' -e "s/${VERSION}/${TIMESTAMPED_VERSION}/g" contracts/package.json && head contracts/package.json # incremental npm package version for testing |
50 | | - ### [END BLOCK] |
51 | | - npm ci |
52 | | - bash scripts/git-user-config.sh |
53 | | - git tag -m {,}"${GIT_TAG}" |
54 | | - CI=true git push origin tag "${GIT_TAG}" |
55 | | - cd "contracts/" |
56 | | - # Intentionally escape $ to avoid interpolation and writing the token to disk |
57 | | - echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc |
58 | | - npm publish --tag "${NPM_TAG}" |
59 | | - echo "GIT_TAG=${GIT_TAG}" >> "$GITHUB_ENV" |
| 34 | + path: upgradeable |
| 35 | + - run: cd "${UPGRADEABLE_DIR}" && bash ${{ github.workspace }}/scripts/git-user-config.sh |
| 36 | + - id: publish |
| 37 | + name: Publish |
| 38 | + run: bash scripts/release/workflow/publish-upgradeable.sh |
60 | 39 | env: |
61 | | - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 40 | + VANILLA_COMMIT: ${{ steps.vanilla.outputs.commit }} |
62 | 41 | - name: Create Github Release Note |
| 42 | + run: bash scripts/release/workflow/github-release-upgradeable.sh |
63 | 43 | env: |
64 | 44 | GITHUB_TOKEN: ${{ secrets.GH_TOKEN_UPGRADEABLE }} |
65 | | - run: | |
66 | | - gh release create "${GIT_TAG}" \ |
67 | | - --repo="${UPGRADEABLE_REPO}" \ |
68 | | - --title="${GIT_TAG}" \ |
69 | | - --notes="$(gh release view "${OLD_GIT_TAG}" --repo="${VANILLA_REPO}" --json body -q .body)" `# TODO: Update tag before merging` \ |
70 | | - "${ADDITIONAL_OPTION_IF_PRERELEASE}" |
| 45 | + GIT_TAG: ${{ steps.publish.outputs.git_tag }} |
| 46 | + ADDITIONAL_OPTION_IF_PRERELEASE: ${{ steps.publish.outputs.additional_option_if_prerelease }} |
0 commit comments