diff --git a/.changeset/config.json b/.changeset/config.json index cd1f663f161..267c3a001eb 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -11,5 +11,9 @@ "access": "public", "baseBranch": "master", "updateInternalDependencies": "patch", - "ignore": [] + "ignore": [], + "snapshot": { + "useCalculatedVersion": true, + "prereleaseTemplate": "{tag}-{commit}" + } } diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000000..df7dce4fad7 --- /dev/null +++ b/.github/workflows/release.yaml @@ -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 diff --git a/RELEASE.md b/RELEASE.md index 23fc23eec35..d7d21d06dac 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -10,9 +10,9 @@ 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. @@ -20,7 +20,7 @@ finally `changeset publish` will go thru and publish to npm the packages that ne 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. diff --git a/package.json b/package.json index 05727a8dd3a..d0b73917e37 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index ed90358ba48..37afef8c0d3 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -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",