Workflow file for this run
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 | ||
DEPLOY_KEY: | ||
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: "16" | ||
registry-url: "https://registry.npmjs.org" | ||
- name: Install dependencies | ||
run: npm i | ||
- name: Bump Version | ||
id: bump_version | ||
run: | | ||
git checkout -b increate_version_PR | ||
git config user.name flex-runtime | ||
git config user.email [email protected] | ||
npm run version:${{ inputs.TAG }} ${{ inputs.VERSION }} | ||
git add . | ||
git diff --staged --quiet && (echo "pushVersion=false" >> $GITHUB_OUTPUT) || (git commit -m "Updating version" --no-verify && git push origin increate_version_PR --no-verify && echo "pushVersion=true" >> $GITHUB_OUTPUT) | ||
- name: Create Pull Request for version | ||
if: steps.bump_version.outputs.pushVersion == 'true' | ||
run: | | ||
gh pr create --base main --title "Update version" --body "Update version" | ||
env: | ||
GITHUB_TOKEN: ${{ steps.get_app_token.outputs.token }} | ||
- name: Approve PR | ||
if: steps.bump_version.outputs.pushVersion == 'true' | ||
run: | | ||
git config user.name flex-runtime | ||
git config user.email [email protected] | ||
gh pr review --approve | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.G_TOKEN }} |