snapshot-releasing chore/auto-snap-release #6
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: Snapshot Releasing | |
run-name: snapshot-releasing ${{ github.head_ref || github.ref_name }} | |
on: | |
push: | |
branches: | |
- "changesets/**" | |
- chore/auto-snap-release | |
# 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 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: '"PUBLISHED_PACKAGES=$(yarn ts-node publish.ts)" >> "$GITHUB_OUTPUT"' | |
# 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.versioning.outputs.PUBLISHED_PACKAGES }} | |
install: | |
name: Install Snapshot Releases | |
needs: ['release'] | |
# if any packages where published install them else report success | |
runs-on: ['self-hosted', 'org', 'npm-publish'] | |
steps: | |
# for each package call npm install package@version | |
# possibly use a matrix | |
- run: echo ${{needs.release.outputs.packages}} |