Skip to content

Merge releases/6.x.x/6.15.x/6.15.2-rc3 into main #19

Merge releases/6.x.x/6.15.x/6.15.2-rc3 into main

Merge releases/6.x.x/6.15.x/6.15.2-rc3 into main #19

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
with:
token: ${{ secrets.CI_DEV_GITHUB_TOKEN }}
persist-credentials: true
- name: Setup Git Authentication
env:
COMMIT_AUTHOR: ${{ secrets.CI_COMMIT_AUTHOR }}
COMMIT_EMAIL: ${{ secrets.CI_COMMIT_EMAIL }}
MY_PERSONAL_ACCESS_TOKEN: ${{ secrets.CI_DEV_GITHUB_TOKEN }}
run: |
git config --global user.name $COMMIT_AUTHOR
git config --global user.email $COMMIT_EMAIL
git config --global credential.helper 'cache --timeout=300'
git config --global --add "credential.https://github.com.username" "x-access-token"
echo "https://x-access-token:$MY_PERSONAL_ACCESS_TOKEN@github.com" > ~/.git-credentials
- uses: mdecoleman/pr-branch-name@2.0.0
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/pr-branch-name@2.0.0
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