Skip to content

Commit

Permalink
ci: add v3 release (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mercy811 authored Aug 22, 2024
2 parents 9540c38 + 78d358a commit e7ae8c3
Showing 1 changed file with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/publish-v3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Publish v3.x

on:
workflow_dispatch:
inputs:
releaseVersion:
description: 'Release version (ie. minor, patch)'
required: true
type: choice
options:
- minor
- patch
- preminor
- prepatch
- prerelease

jobs:
authorize:
name: Authorize
runs-on: ubuntu-latest
steps:
- name: ${{ github.actor }} permission check to do a release
uses: 'lannonbr/[email protected]'
with:
permission: 'admin'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [authorize]
permissions:
id-token: write
contents: write
env:
RELEASE_VERSION: ${{ github.event.inputs.releaseVersion }}

steps:
- name: Check out git repository
uses: actions/checkout@v3
with:
ref: v3.x

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install project dependencies
run: |
yarn install --frozen-lockfile
- name: Configure Git User
run: |
git config --global user.name amplitude-sdk-bot
git config --global user.email [email protected]
- name: Configure NPM User
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_PUBLISH_TOKEN }}" > ~/.npmrc
npm whoami
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::358203115967:role/github-actions-role
aws-region: us-west-2

- name: Create new version
run: |
CURRENT_VERSION=$(npm info . version)
STAGED_VERSION=$(npx semver $CURRENT_VERSION -i ${{ env.RELEASE_VERSION }} --preid beta)
npm version $STAGED_VERSION
git push
git push origin v$STAGED_VERSION
- name: Pubish package
run: |
npm publish
- name: Build package
run: |
npm run build:prod
- name: Publish to Amplitude CDN
run: |
npm run deploy
env:
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }}

0 comments on commit e7ae8c3

Please sign in to comment.