Releases/6.x.x/6.13.x/6.13.0 rc1 #29
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: | |
- 'master' | |
paths-ignore: | |
- '**.md' | |
- '**.yml' | |
- 'examples/**' | |
- 'hooks/**' | |
- 'resources/**' | |
- 'testsScripts/**' | |
- 'docs/**' | |
- | |
jobs: | |
Deploy-To-Production: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- 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 publish | |
- name: Generate and send slack report | |
env: | |
SLACK_TOKEN: ${{ secrets.CI_SLACK_TOKEN }} | |
JIRA_TOKEN: ${{ secrets.CI_JIRA_TOKEN }} | |
JIRA_FIXED_VERSION: "Cordova SDK v${{env.PLUGIN_VERSION}}" | |
RELEASE_BRACH_NAME: ${{env.RELEASE_BRANCH_NAME}} | |
run: | | |
chmod +x .github/workflows/scripts/releaseNotesGenerator.sh | |
.github/workflows/scripts/releaseNotesGenerator.sh $JIRA_TOKEN "$JIRA_FIXED_VERSION" | |
android_sdk_version=$(cat README.md | grep 'Android AppsFlyerSDK' | grep -Eo '[0-9].[0-9]+.[0-9]+') | |
ios_sdk_version=$(cat README.md | grep 'iOS AppsFlyerSDK' | grep -Eo '[0-9].[0-9]+.[0-9]+') | |
CHANGES=$(cat "$JIRA_FIXED_VERSION-releasenotes".txt) | |
curl -X POST -H 'Content-type: application/json' --data '{"jira_fixed_version": "'"${{env.JIRA_FIXED_VERSION}}"'", "deploy_type": "Production", "install_tag": "latest", "git_branch": "'"$RELEASE_BRACH_NAME"'", "changes_and_fixes": "'"$CHANGES"'", "android_dependency": "'"$android_sdk_version"'", "ios_dependency": "'"$ios_sdk_version"'"}' "$SLACK_TOKEN" | |