Merge releases/6.x.x/6.14.x/6.14.3-rc1 into main #56
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 plugin to production | |
on: | |
pull_request: | |
types: | |
- closed | |
branches: | |
- 'main' | |
paths-ignore: | |
- '**.md' | |
- '**.yml' | |
- 'examples/**' | |
- 'docs/**' | |
- 'assets/**' | |
jobs: | |
# Pre-Release-To-Prod: | |
# if: github.event.pull_request.merged == true | |
# uses: ./.github/workflows/pre-release-workflow.yml | |
# secrets: inherit | |
Build-Sample-Apps: | |
# needs: [ Pre-Release-To-Prod ] | |
uses: ./.github/workflows/build-apps-workflow.yml | |
secrets: inherit | |
Deploy-To-Production: | |
needs: [ Build-Sample-Apps ] | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
- name: Install dependency | |
run: | | |
npm i rimraf | |
- name: Login to Github | |
env: | |
COMMIT_AUTHOR: ${{ secrets.CI_COMMIT_AUTHOR }} | |
COMMIT_EMAIL: ${{ secrets.CI_COMMIT_EMAIL }} | |
run: | | |
git config --global user.name $COMMIT_AUTHOR | |
git config --global user.email $COMMIT_EMAIL | |
- uses: mdecoleman/[email protected] | |
id: vars | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Determine release tag and release branch | |
run: | | |
TAG=$(echo "${{ steps.vars.outputs.branch }}" | grep -Eo '[0-9]+.[0-9]+.[0-9]+') | |
echo "PLUGIN_VERSION=$TAG" >> $GITHUB_ENV | |
echo "RELEASE_BRANCH_NAME=${{ steps.vars.outputs.branch }}" >> $GITHUB_ENV | |
echo "push new release >> $TAG" | |
- name: "Create release" | |
env: | |
TAG: ${{env.PLUGIN_VERSION}} | |
uses: "actions/github-script@v5" | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
script: | | |
try { | |
await github.rest.repos.createRelease({ | |
draft: false, | |
generate_release_notes: false, | |
name: process.env.TAG, | |
owner: context.repo.owner, | |
prerelease: false, | |
repo: context.repo.repo, | |
tag_name: process.env.TAG | |
}); | |
} catch (error) { | |
core.setFailed(error.message); | |
} | |
- name: Push to NPM | |
env: | |
CI_NPM_TOKEN: ${{ secrets.CI_NPM_TOKEN }} | |
run: | | |
echo "//registry.npmjs.org/:_authToken=$CI_NPM_TOKEN" > ~/.npmrc | |
npm run build | |
npm publish | |
- name: Generate and send slack report | |
env: | |
SLACK_TOKEN: ${{ secrets.CI_SLACK_TOKEN }} | |
JIRA_TOKEN: ${{ secrets.CI_JIRA_TOKEN }} | |
JIRA_FIXED_VERSION: "Capacitor SDK v${{env.PLUGIN_VERSION}}" | |
run: | | |
ANDROID_SDK_VERSION=`cat package.json | jq .androidSdkVersion` | |
IOS_SDK_VERSION=`cat package.json | jq .iosSdkVersion` | |
PLUGIN_VERSION=`cat package.json | jq .version` | |
BUILD_NUMBER=`cat package.json | jq .buildNumber` | |
chmod +x .github/workflows/scripts/releaseNotesGenerator.sh | |
.github/workflows/scripts/releaseNotesGenerator.sh $JIRA_TOKEN "$JIRA_FIXED_VERSION" | |
CHANGES=$(cat "$JIRA_FIXED_VERSION-releasenotes".txt) | |
curl -X POST -H 'Content-type: application/json' --data '{"jira_fixed_version": "'"$JIRA_FIXED_VERSION"'", "deploy_type": "Production", "install_tag": "latest", "git_branch": "'"$RELEASE_BRANCH_NAME"'", "changes_and_fixes": "'"$CHANGES"'", "plugin_version": "'"${{env.PLUGIN_VERSION}}"'", "android_dependency": "'"$ANDROID_SDK_VERSION"'", "ios_dependency": "'"$IOS_SDK_VERSION"'"}' "$SLACK_TOKEN" |