FLEXY-5323 deploy test fix for new version #4
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
on: | ||
workflow_call: | ||
inputs: | ||
TAG: | ||
description: 'A tag passed from the caller workflow, it decides the type of release. Allowed values are [rc | beta | alpha | public | dev]' | ||
required: true | ||
type: string | ||
VERSION: | ||
description: 'A specific version passed from the caller workflow which will be release as it is.' | ||
required: true | ||
type: string | ||
BRANCH: | ||
description: 'A branch passed from the caller workflow, it decides which branch will be pushed to npm.' | ||
required: true | ||
type: string | ||
ENVIRONMENT: | ||
description: 'A environment passed from the caller workflow, it controls the reviewing process of a release.' | ||
required: true | ||
type: string | ||
default: alpha_release | ||
secrets: | ||
NODE_AUTH_TOKEN: | ||
required: true | ||
SLACK_WEB_HOOK: | ||
required: true | ||
G_TOKEN: | ||
required: true | ||
APP_ID: | ||
required: true | ||
APP_KEY: | ||
required: true | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
environment: ${{ inputs.ENVIRONMENT }} | ||
steps: | ||
- uses: tibdex/github-app-token@v1 | ||
id: get_app_token | ||
with: | ||
app_id: ${{ secrets.APP_ID }} | ||
private_key: ${{ secrets.APP_KEY }} | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20' | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Slack Started Notification | ||
uses: rtCamp/action-slack-notify@v2 | ||
env: | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEB_HOOK }} | ||
SLACK_COLOR: ${{ job.status }} | ||
SLACK_USERNAME: Github Actions | ||
SLACK_ICON_EMOJI: ':ship:' | ||
SLACK_TITLE: 'Flex Plugins CLI' | ||
SLACK_MESSAGE: ':ship_it_parrot: Releasing new public *version* of `flex-plugin-builder`' | ||
MSG_MINIMAL: actions url | ||
- name: Publish Version | ||
run: | | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
npm run publish:${{ inputs.TAG }} ${{ inputs.VERSION }} | ||
env: | ||
VERSION: ${{ inputs.VERSION }} | ||
BRANCH: ${{ inputs.BRANCH }} | ||
NODE_OPTIONS: --no-experimental-fetch | ||
CI: '' | ||
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | ||
- name: Retrieve Version | ||
id: publicVersion | ||
run: | | ||
echo "version=$(awk '/version/{gsub(/("|",)/,"",$2);print $2}' lerna.json)" | ||
echo "version=$(awk '/version/{gsub(/("|",)/,"",$2);print $2}' lerna.json)" >> "$GITHUB_OUTPUT" | ||
- name: Slack Completed Notification | ||
uses: rtCamp/action-slack-notify@v2 | ||
env: | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEB_HOOK }} | ||
SLACK_COLOR: ${{ job.status }} | ||
SLACK_USERNAME: Github Actions | ||
SLACK_ICON_EMOJI: ':ship:' | ||
SLACK_TITLE: 'Flex Plugins CLI' | ||
SLACK_MESSAGE: '🎉:tada: Released a new public *version* `${{ steps.publicVersion.outputs.version }}`' | ||
MSG_MINIMAL: actions url | ||
- name: Commit Version | ||
id: commit_version | ||
run: | | ||
git checkout -b bump-version-"$VERSION_NUMBER" | ||
git push origin bump-version-"$VERSION_NUMBER" --no-verify | ||
env: | ||
VERSION_NUMBER: ${{ steps.publicVersion.outputs.version }} | ||
- name: Create PR for version | ||
run: | | ||
gh pr create --base main --title "Update version" --body "Update version" | ||
env: | ||
GITHUB_TOKEN: ${{ steps.get_app_token.outputs.token }} | ||
- name: Approve and Merge PR | ||
run: | | ||
gh pr review --approve | ||
gh pr merge --auto --merge | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.G_TOKEN }} |