-
Notifications
You must be signed in to change notification settings - Fork 8
90 lines (85 loc) · 3.31 KB
/
prerelease.yml
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
name: Snapshot Releasing
run-name: snapshot-releasing ${{ github.head_ref || github.ref_name }}
on:
push:
branches:
# Publish each time changeset-release branch is updated (which happens each time a changeset is merged to master)
- "changeset-release/**"
- chore/auto-snap-release # for testing remove me when done
# This workflow should on push to a changeset branch
# 1. checkout repo, install, build
# 2. version packages as a snapshot
# 3. publish packages to npm if there are any to be published || or exit success
# b. save a list of packages that were published
# 4. use the list to install the packages that were just published
concurrency: ${{ github.workflow }}-${{ github.ref }}
env:
ACTIONS_STEP_DEBUG: true
jobs:
release:
name: Snapshot Release
runs-on: ['self-hosted', 'org', 'npm-publish']
permissions:
contents: write
id-token: write
pull-requests: write
repository-projects: write
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- 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/apps-tooling-circle/npm-publish-token":"NPM_TOKEN"}'
- name: Setup Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: 'Setup yarn'
shell: bash
run: |
npm install --global yarn
source ~/.bashrc
- name: Install Dependencies
shell: bash
run: yarn
- name: Build packages
shell: bash
run: yarn build
- name: Version packages
id: 'versioning'
run: yarn changeset version --snapshot alpha
# when there are version changes "All files have been updated. Review them and commit at your leisure"
# when there are no version changes "No unreleased changesets found, exiting"
- name: Publish packages
run: echo PUBLISHED_PACKAGES=$(yarn --silent ts-node publish.ts) >> $GITHUB_OUTPUT
id: 'publishing'
env:
NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }}
- name: View output
run: echo ${{ steps.publishing.outputs.PUBLISHED_PACKAGES }}
# Publishing "@celo/phone-number-privacy-common" at "3.0.4-alpha-964a99345"
# id like to take all lines like the above and create an array of packages with form
# ["@celo/[email protected]"]
outputs:
# output array of packages like ["@celo/[email protected]"]
packages: ${{ steps.publishing.outputs.PUBLISHED_PACKAGES }}
example: "This is a static example"
install:
name: Install Snapshot Releases
needs: ['release']
# if any packages where published install them else report success
if: ${{ needs.release.outputs.packages != 'no-op' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
packages: ${{ fromJson(needs.release.outputs.packages) }}
steps:
# for each package call npm install package@version
- name: Install ${{ matrix.package }}
run: npm install ${{ matrix.package }}