Skip to content

Merge pull request #901 from twilio/add_token #2

Merge pull request #901 from twilio/add_token

Merge pull request #901 from twilio/add_token #2

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
APP_ID:
required: true
APP_KEY:
required: true
GITHUB_TOKEN:

Check failure on line 30 in .github/workflows/~reusable_publish.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/~reusable_publish.yaml

Invalid workflow file

secret name `GITHUB_TOKEN` within `workflow_call` can not be used since it would collide with system reserved name
required: true
jobs:
publish:
runs-on: ubuntu-latest
environment: ${{ inputs.ENVIRONMENT }}
steps:
- 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: Publish Version
run: |
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: Bump Version
id: bump_version
run: |
git checkout -b increate_version_PR
git config user.name github-actions
git config user.email [email protected]
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: ${{ secrets.GITHUB_TOKEN }}
- name: Approve and merge PR
if: steps.bump_version.outputs.pushVersion == 'true'
run: |
gh pr review --approve
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Slack 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: "🎉 Released a new version with *tag* `${{ inputs.TAG }}` and *version* `${{ inputs.VERSION }}`"
MSG_MINIMAL: actions url