Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add v3 release #53

Merged
merged 4 commits into from
Aug 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}
Loading