Skip to content

Release

Release #34

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
draft:
description: 'Draft'
required: true
default: false
type: boolean
update_all:
description: 'Force update all packages'
required: true
default: false
type: boolean
version-increment-type:
description: 'Which part of the version to increment:'
required: true
type: choice
options:
- major
- minor
- patch
default: 'patch'
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
env:
# The setup-node action configures this env var as the source for the npm auth token
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
# Check out the repo with credentials that can bypass branch protection, and fetch git history instead of just latest commit
- uses: actions/checkout@v3
with:
token: ${{ secrets.AUTOMATION_USER_TOKEN }}
fetch-depth: 0
- name: Configure AWS Credentials
uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_GHA }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_GHA }}
aws-region: us-east-1
- name: Configure git
run: |
git config --global user.email "[email protected]"
git config --global user.name "DevCycle Automation"
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- name: Validate npm config and auth
run: |
npm config list
npm whoami
- run: yarn --immutable
# Only one of the following two steps will run, depending on whether the `update_all` input is set
- name: Increment affected package versions with lerna
run: |
./scripts/lerna-version-ci.sh --version-increment-type "${{ inputs.version-increment-type }}"
if: inputs.update_all != true
- name: Increment all package versions with lerna
run: |
./scripts/lerna-version-ci.sh --all-packages --version-increment-type="${{ inputs.version-increment-type }}"
if: inputs.update_all == true
- name: Push version changes and tags
run: |
git push origin HEAD:main --follow-tags
if: inputs.draft != true && github.ref == 'refs/heads/main'
- name: Push to npm
run: |
yarn npm-publish
env:
DEVCYCLE_PROD_SLEUTH_API_TOKEN: ${{ secrets.SLEUTH_API_KEY }}
if: inputs.draft != true
- name: Push to npm (dry run)
run: |
yarn npm-publish --dry-run
env:
DEVCYCLE_PROD_SLEUTH_API_TOKEN: ${{ secrets.SLEUTH_API_KEY }}
if: inputs.draft == true
- name: Build UMD bundles
run: |
yarn nx build:cdn js
- name: Upload CDN Release
run: aws s3 sync dist/sdk/js s3://js.devcycle.com/ --include "devcycle.min.js*" --acl public-read
if: inputs.draft != true && github.ref == 'refs/heads/main'