Skip to content

Commit

Permalink
Automated Package Publishing (#10661)
Browse files Browse the repository at this point in the history
* configure for snapshot releases

* undo mistake of making pkg private
  • Loading branch information
aaronmgdr authored Oct 20, 2023
1 parent ddfdd04 commit 47e5fd8
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
"ignore": [],
"snapshot": {
"useCalculatedVersion": true,
"prereleaseTemplate": "{tag}-{commit}"
}
}
52 changes: 52 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release Packages

on:
push:
branches:
- main
- 'prerelease/*'

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release to NPM
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: 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
6 changes: 3 additions & 3 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ This will bring up an interactive console which asks which packages are affect a

## Auto Releasing

(coming soon)
The Release.yaml workflow will create a PR called "Version Packages", each time a PR is merged to master with changeset files this PR will be rebased and updated to show what the versions would be of published then. Merging this PR in will lead to packages being built and published to npm and github release notes being published.

## Manual Releasing
## Manual Releasing (discouraged)

when time to release new versions of npm package run `changeset version` this will look thru the changeset files that have been generated since last release to bump the versions for package automatically to major if any changesets specify major change minor if only minor and patch if a the package had no changesets of its own but depends on one which will be updated.

finally `changeset publish` will go thru and publish to npm the packages that need publishing.

after go ahead and run `git push --follow-tags` to push git tags up to github.

### For Pre Releasing
## Pre Releasing

changesets has 2 strategies for pre release versions.

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"keys:decrypt": "bash scripts/key_placer.sh decrypt",
"keys:encrypt": "bash scripts/key_placer.sh encrypt",
"check:packages": "node ./scripts/check-packages.js",
"release": "yarn build && yarn cs publish",
"celotool": "yarn --cwd packages/celotool run --silent cli",
"celocli": "yarn --cwd packages/cli run --silent celocli",
"update-dependency-graph": "ts-node ./scripts/update_dependency_graph.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@celo/dev-utils",
"version": "0.0.1",
"private": true,
"private": false,
"description": "util package for celo packages that should only be a devDependency",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
Expand Down

0 comments on commit 47e5fd8

Please sign in to comment.