Martinvol/state fix #2425
This file contains 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: Publish ABIs and Solidity files to NPM | |
on: | |
push: | |
branches: [release/core-contracts/*] | |
tags: | |
- core-contracts.v* | |
pull_request: | |
branches: [release/core-contracts/*, master] | |
paths: | |
- 'packages/protocol/**' | |
release: | |
types: [released] | |
workflow_dispatch: | |
inputs: | |
npm_tag: | |
description: 'NPM TAG e.g. alpha, pre-merge (default: canary) ' | |
required: true | |
type: string | |
jobs: | |
publish: | |
runs-on: ['self-hosted', 'org', 'npm-publish'] | |
permissions: | |
contents: write | |
id-token: write | |
pull-requests: write | |
repository-projects: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Akeyless Get Secrets | |
id: get_auth_token | |
uses: docker://us-west1-docker.pkg.dev/devopsre/akeyless-public/akeyless-action:latest | |
with: | |
api-url: https://api.gateway.akeyless.celo-networks-dev.org | |
access-id: p-kf9vjzruht6l | |
static-secrets: '{"/static-secrets/NPM/npm-publish-token":"NPM_TOKEN"}' | |
# Setup .npmrc file to publish to npm | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
#scope: '@celo' | |
- name: 'Setup yarn' | |
shell: bash | |
run: | | |
npm install --global yarn | |
source ~/.bashrc | |
- name: 'Install packages' | |
shell: bash | |
run: yarn | |
- name: Determine release type and version (or dry run) | |
# This is what sets the RELEASE_TYPE and RELEASE_VERSION env variables | |
run: yarn --silent determine-release-version >> "$GITHUB_ENV" | |
working-directory: packages/protocol | |
env: | |
GITHUB_TAG: ${{ github.ref_name }} | |
NPM_PACKAGE: "@celo/contracts" | |
NPM_TAG: ${{ inputs.npm_tag }} | |
- name: 'Build packages' | |
shell: bash | |
run: yarn build --ignore @celo/celotool --ignore @celo/env-tests --include-dependencies | |
- name: Compile solidity contracts and typescript files | |
run: yarn prepare_contracts_and_abis_publishing | |
working-directory: packages/protocol | |
env: | |
RELEASE_TYPE: ${{ env.RELEASE_TYPE }} | |
RELEASE_VERSION: ${{ env.RELEASE_VERSION }} | |
# a safety check especially useful if some package is upgraded | |
- name: 'Validate ABIS Exports' | |
shell: bash | |
run: yarn validate_abis_exports | |
working-directory: packages/protocol | |
- name: Publish @celo/contracts | |
run: | | |
cat package.json | |
npm publish $RELEASE_TYPE $DRY_RUN | |
working-directory: packages/protocol/contracts | |
env: | |
RELEASE_TYPE: --tag ${{ env.RELEASE_TYPE != '' && env.RELEASE_TYPE || 'canary' }} | |
RELEASE_VERSION: ${{ env.RELEASE_VERSION }} | |
NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }} | |
DRY_RUN: ${{ env.RELEASE_VERSION == '' && '--dry-run' || '' }} | |
- name: Publish @celo/abis | |
run: | | |
cat package.json | |
npm publish $RELEASE_TYPE $DRY_RUN | |
working-directory: packages/protocol/abis | |
env: | |
RELEASE_TYPE: --tag ${{ env.RELEASE_TYPE != '' && env.RELEASE_TYPE || 'canary' }} | |
RELEASE_VERSION: ${{ env.RELEASE_VERSION }} | |
NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }} | |
DRY_RUN: ${{ env.RELEASE_VERSION == '' && '--dry-run' || '' }} |