Skip to content

Merge releases/6.x.x/6.13.x/6.13.0-rc1 into main #11

Merge releases/6.x.x/6.13.x/6.13.0-rc1 into main

Merge releases/6.x.x/6.13.x/6.13.0-rc1 into main #11

name: Prepare plugin for production
on:
pull_request:
types: [ labeled ]
jobs:
Prepare-Plugin-For-Production:
if: startsWith(github.head_ref, 'releases/') && github.event.label.name == 'Ready For Production'
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: Update package.json file
run: |
plugin_version=$(echo "${{ steps.vars.outputs.branch }}" | grep -Eo '[0-9]+.[0-9]+.[0-9]+')
# we export plugin_version and release branch name as env so we can use them in the next step
echo "PLUGIN_VERSION=$plugin_version" >> $GITHUB_ENV
echo "GIT_BRANCH_RELEASE=${{ steps.vars.outputs.branch }}" >> $GITHUB_ENV
echo "Updating plugin to version $plugin_version"
chmod +x .github/workflows/scripts/updatePluginVersion.sh
chmod +x .github/workflows/scripts/updateBuildNumber.sh
.github/workflows/scripts/updatePluginVersion.sh $plugin_version
.github/workflows/scripts/updateBuildNumber.sh ${{github.run_number}}
git commit -m "Update Plugin Version"
git push origin HEAD:${{ steps.vars.outputs.branch }} --force
- name: Update CHANGELOG.md
env:
JIRA_TOKEN: ${{ secrets.CI_JIRA_TOKEN }}
JIRA_FIXED_VERSION: "Capacitor SDK v${{env.PLUGIN_VERSION}}"
run: |
chmod +x .github/workflows/scripts/releaseNotesGenerator.sh
.github/workflows/scripts/releaseNotesGenerator.sh $JIRA_TOKEN "$JIRA_FIXED_VERSION"
NEW_VERSION_RELEASE_NOTES=$(cat "$JIRA_FIXED_VERSION-releasenotes".txt)
NEW_VERSION_SECTION="## ${{ env.PLUGIN_VERSION }}\n Release date: *$(date +%F)*\n\n$NEW_VERSION_RELEASE_NOTES\n"
echo -e "$NEW_VERSION_SECTION\n$(cat CHANGELOG.md)" > CHANGELOG.md
git add CHANGELOG.md
git commit -m "Update CHANGELOG.md"
git push origin HEAD:${{ env.GIT_BRANCH_RELEASE }} --force
Approve-Pull-Request:
needs: [ Prepare-Plugin-For-Production ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: mdecoleman/[email protected]
id: vars
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Export branch name
run: |
echo "RELEASE_BRANCH_NAME=${{ steps.vars.outputs.branch }}" >> $GITHUB_ENV
- name: approve pull request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: | # approve the pull request of the current branch
gh pr review "$PR_NUMBER" --approve