-
Notifications
You must be signed in to change notification settings - Fork 11
123 lines (114 loc) · 4 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Release Packages
on:
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: ${{ steps.changesets.outputs.publishedPackages }}
published: ${{ steps.changesets.outputs.published }}
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 20.x
uses: actions/setup-node@v4
with:
node-version: 20.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: '20'
cache: 'yarn'
- name: Install Dependencies
shell: bash
run: yarn
- name: Create Release Pull Request or Publish to npm
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
# release gives an array of published packages as jsob objects, we need an array of strings for installing
prepare:
name: Format Output for Install
if: needs.release.outputs.published
needs: release
runs-on: ubuntu-latest
container:
image: node:20-bullseye
outputs:
result: "${{ steps.map.outputs.output }}"
steps:
- name: Install jq
if: needs.release.outputs.published
uses: dcarbone/[email protected]
- name: Format Published Packages Array
if: needs.release.outputs.published
uses: cloudposse/github-action-jq@main
id: map
with:
compact: true
raw-output: true
input: '${{ needs.release.outputs.publishedPackages }}'
script: |-
map("\(.name)@\(.version)")
# last line of defense to ensure that the packages were published correctly
install-released-packages:
name: Install Released Packages
needs: [prepare, release]
if: needs.release.outputs.published
runs-on: ubuntu-latest
container:
image: node:20-bullseye
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 }}