Install Packages post release #272
Workflow file for this run
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: Release Packages | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- master | |
- hotfixes | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
release: | |
name: Prepare or Publish | |
runs-on: ['self-hosted', 'org', 'npm-publish'] | |
permissions: | |
contents: write | |
id-token: write | |
pull-requests: write | |
repository-projects: write | |
outputs: | |
publishedPackages: '[{"name": "@celo/celocli", "version": "5.0.0"}, {"name": "@celo/contractkit", "version": "8.0.0"}]' | |
# publishedPackages: ${{ steps.changesets.outputs.publishedPackages }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- 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"}' | |
- name: Setup Node.js 18.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
- name: 'enable corepack for yarn' | |
run: sudo corepack enable yarn | |
shell: bash | |
# must call twice because of chicken and egg problem with yarn and node | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
- name: Install Dependencies | |
shell: bash | |
run: yarn | |
# - name: Create Release Pull Request or Publish to npm | |
# if: false | |
# id: changesets | |
# uses: changesets/action@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# NPM_TOKEN: ${{ env.NPM_TOKEN }} | |
# with: | |
# # This expects you to have a script called release which does a build for your packages and calls changeset publish | |
# publish: yarn release | |
# version: yarn version-and-reinstall | |
prepare: | |
name: Prepare for Install | |
needs: release | |
runs-on: ubuntu-latest | |
container: | |
image: node:20-bullseye | |
outputs: | |
result: "${{ steps.current.outputs.output }}" | |
steps: | |
- uses: cloudposse/github-action-jq@main | |
id: current | |
with: | |
compact: true | |
input: '${{ needs.release.outputs.publishedPackages }}' | |
script: |- | |
.[] | "\(.name)@\(.version)" | |
install-released-packages: | |
name: Install Released Packages | |
runs-on: ubuntu-latest | |
container: | |
image: node:20-bullseye | |
needs: prepare | |
strategy: | |
fail-fast: false | |
max-parallel: 12 | |
matrix: | |
package: ${{fromJson(needs.prepare.outputs.result)}} | |
steps: | |
- name: Install @celo/celocli dependencies | |
if: contains(matrix.package, '@celo/celocli') | |
run: | | |
apt update | |
apt install -y libusb-1.0-0-dev libudev-dev | |
npm install node-gyp --global | |
- name: Installing ${{ matrix.package }} package | |
run: npm install ${{ matrix.package }} --global | |
- name: Ensure sample of celocli commands run | |
if: contains(matrix.package, '@celo/celocli') | |
run: | | |
celocli --version | |
celocli account:new | |
echo "checking celo community fund balance" | |
celocli account:balance 0xD533Ca259b330c7A88f74E000a3FaEa2d63B7972 --node celo | |
celocli network:whitelist --node alfajores | |
open-docs-pr: | |
needs: release | |
if: ${{ contains(fromJson(needs.release.outputs.publishedPackages).*.name, '@celo/celocli') }} | |
uses: celo-org/developer-tooling/.github/workflows/open-docs-pr.yml@master | |
with: | |
commit: ${{ github.sha }} |