Publish Next Release (Manual) #7
Workflow file for this run
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: Publish Next Release (Manual) | |
on: | |
workflow_dispatch: | |
env: | |
NODE_VERSION: 18 | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: AWS, credentials setup | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: us-west-1 | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Add INPUT_SHA env var | |
run: | | |
export INPUT_SHA=$(git rev-parse ${{ github.ref }}) | |
echo "INPUT_SHA=`echo $INPUT_SHA`" >> $GITHUB_ENV | |
- name: Install branch-github-actions | |
uses: actions/checkout@v4 | |
with: | |
repository: BranchMetrics/branch-github-actions | |
ref: master | |
path: .branch-github-actions | |
token: ${{ secrets.BRANCHLET_ACCESS_TOKEN_PUBLIC }} | |
- name: Get next release version | |
uses: actions/github-script@v7 | |
id: next-version | |
with: | |
result-encoding: string | |
script: | | |
const getNextVersion = require('./.branch-github-actions/custom-scripts/next-version'); | |
const nextVersion = await getNextVersion({ | |
core, | |
github, | |
context, | |
sha: process.env.INPUT_SHA, | |
}); | |
return nextVersion; | |
env: | |
INPUT_SHA: ${{ env.INPUT_SHA }} | |
- name: Install Node ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
registry-url: 'https://registry.npmjs.org' | |
# Do this before npm configure because it writes the package.json version | |
- name: Write version to files | |
run: | | |
./deployment/write-versions.sh ${{ steps.next-version.outputs.result }} | |
- name: Configure NPM | |
run: npm ci | |
- run: make release | |
- name: Publish to s3 | |
run: | | |
./deployment/release-s3.sh ${{ steps.next-version.outputs.result }} | |
- name: Publish to npm | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISHER_TOKEN }} | |
run: npm publish | |
- name: Create Github Release | |
uses: actions/github-script@v7 | |
env: | |
GE_NEXT_VERSION: ${{ steps.next-version.outputs.result }} | |
INPUT_SHA: ${{ env.INPUT_SHA }} | |
with: | |
result-encoding: string | |
script: | | |
const createRelease = require('./.branch-github-actions/custom-scripts/create-release'); | |
const sha = process.env.INPUT_SHA; | |
const version = process.env.GE_NEXT_VERSION; | |
await createRelease({ | |
core, | |
context, | |
github, | |
sha, | |
version, | |
}); |