Release Web Kit #13
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: Release Web Kit | |
on: | |
workflow_dispatch: | |
inputs: | |
dryRun: | |
description: 'Do a dry run to preview instead of a real release [true/false]' | |
required: true | |
default: 'true' | |
jobs: | |
# SDK release is done from public/master branch. | |
confirm-public-repo-master-branch: | |
name: 'Confirm release is run from public/master branch' | |
uses: mParticle/mparticle-workflows/.github/workflows/sdk-release-repo-branch-check.yml@stable | |
create-release-branch: | |
name: Create release branch | |
runs-on: ubuntu-latest | |
needs: confirm-public-repo-master-branch | |
steps: | |
- name: Checkout development branch | |
uses: actions/checkout@v3 | |
with: | |
ref: development | |
- name: Create and push release branch | |
run: | | |
git checkout -b release/${{ github.run_number }} | |
git push origin release/${{ github.run_number }} | |
release: | |
name: Perform Release | |
runs-on: ubuntu-latest | |
needs: create-release-branch | |
env: | |
GITHUB_TOKEN: ${{ secrets.MP_INTEGRATIONS_SEMANTIC_RELEASE_BOT }} | |
GIT_AUTHOR_NAME: mparticle-bot | |
GIT_AUTHOR_EMAIL: [email protected] | |
GIT_COMMITTER_NAME: mparticle-bot | |
GIT_COMMITTER_EMAIL: [email protected] | |
steps: | |
- name: Checkout public master branch | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: master | |
- name: Merge release branch into master branch | |
run: | | |
git pull origin release/${{ github.run_number }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Run build | |
run: npm run build --if-present | |
- name: Run tests | |
run: npm run test | |
- name: Curl release.config.js and bundle-and-commit.sh | |
run: | | |
curl "https://raw.githubusercontent.com/mParticle/mparticle-workflows/stable/web/release.config.js" > release.config.js || exit 1 | |
curl "https://raw.githubusercontent.com/mParticle/mparticle-workflows/stable/web/generate-bundle-and-commit.sh" > generate-bundle-and-commit.sh || exit 1 | |
- name: Release --dry-run | |
if: ${{ github.event.inputs.dryRun == 'true'}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.MP_INTEGRATIONS_SEMANTIC_RELEASE_BOT }} | |
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
run: | | |
npx \ | |
-p lodash \ | |
-p semantic-release@17 \ | |
-p @semantic-release/changelog@5 \ | |
-p @semantic-release/git@9 \ | |
-p @semantic-release/exec@5 \ | |
semantic-release --dry-run | |
- name: Release | |
if: ${{ github.event.inputs.dryRun == 'false'}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.MP_INTEGRATIONS_SEMANTIC_RELEASE_BOT }} | |
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
run: | | |
npx \ | |
-p lodash \ | |
-p semantic-release@17 \ | |
-p @semantic-release/changelog@5 \ | |
-p @semantic-release/git@9 \ | |
-p @semantic-release/exec@5 \ | |
semantic-release | |
- name: Push automated release commits to release branch | |
if: ${{ github.event.inputs.dryRun == 'false' }} | |
run: | | |
git status | |
git push origin HEAD:release/${{ github.run_number }} | |
sync-repository: | |
name: Sync development and master branches | |
needs: release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout public master branch | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.MP_INTEGRATIONS_SEMANTIC_RELEASE_BOT }} | |
ref: master | |
- name: Merge release branch into master branch | |
if: ${{ github.event.inputs.dryRun == 'false' }} | |
run: | | |
git pull origin release/${{ github.run_number }} | |
- name: Push release commits to public master branch | |
if: ${{ github.event.inputs.dryRun == 'false'}} | |
run: | | |
git push origin HEAD:master | |
git push origin HEAD:development | |
- name: Delete release branch | |
if: ${{ github.event.inputs.dryRun == 'false' }} | |
run: | | |
git push --delete origin release/${{ github.run_number }} |