Skip to content

Commit

Permalink
chore: use working-directory
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasbrugneaux committed Oct 12, 2023
1 parent e2ef7ec commit 7cfc549
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/publish-contracts-abi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,34 @@ jobs:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
scope: '@celo'

- name: 'Setup yarn'
shell: bash
run: |
npm install --global yarn
source ~/.bashrc
- run: cd packages/protocol
- name: 'Install packages'
run: yarn

- name: Check if a release should be published
run: yarn --silent is_contract_release $GITHUB_TAG >> "$GITHUB_ENV"
working-directory: packages/protocol
env:
GITHUB_TAG: ${{ github.ref_name }}

- if: ${{ env.RELEASE_VERSION != '' }}
name: Compile solidity contracts and typescript files
run: yarn build && yarn prepare_contracts_and_abis_publishing
working-directory: packages/protocol
env:
RELEASE_TYPE: ${{ env.RELEASE_TYPE }}
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}

- if: ${{ env.RELEASE_VERSION != '' }}
name: Publish @celo/contracts
run: yarn publish contracts --tag latest --version $RELEASE_VERSION --no-git-tag-version --dry-run
working-directory: packages/protocol
env:
RELEASE_TYPE: ${{ env.RELEASE_TYPE }}
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
Expand All @@ -66,6 +70,7 @@ jobs:
- if: ${{ env.RELEASE_VERSION != '' }}
name: Publish @celo/abis
run: yarn publish build/contracts --tag latest --version $RELEASE_VERSION --no-git-tag-version --dry-run
working-directory: packages/protocol
env:
RELEASE_TYPE: ${{ env.RELEASE_TYPE }}
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
Expand Down
10 changes: 6 additions & 4 deletions packages/protocol/scripts/is-contract-release.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { SemVer } from 'semver'
const arg = process.argv[2]
if (!arg) {
console.error('Missing git tag')
process.exit(1)
console.error('Missing git tag, skipping next steps.')
process.exit(0)
}

const match = arg.match(/core-contracts.v(.+)/)
if (!match) {
console.error(`Git tag didn't match the following RegExp("/core-contracts.v(.+)/"), got ${arg}`)
process.exit(1)
console.error(
`Git tag didn't match the following RegExp("/core-contracts.v(.+)/"), got ${arg}, skipping next steps.`
)
process.exit(0)
}

const [, gitTag] = match
Expand Down

0 comments on commit 7cfc549

Please sign in to comment.