diff --git a/.github/workflows/callable-npm-publish-release.yml b/.github/workflows/callable-npm-publish-release.yml index 918100921dc..0b88f695d23 100644 --- a/.github/workflows/callable-npm-publish-release.yml +++ b/.github/workflows/callable-npm-publish-release.yml @@ -3,9 +3,21 @@ name: Release to npm and update repository on: workflow_call jobs: + deploy-prep: + name: Prepare for release + runs-on: ubuntu-latest + steps: + - name: Generate a temporary branch name for merge PR + id: generate-branch-name + run: | + echo "BRANCH_NAME=temp/release-merge-$(date +%s)" >> "$GITHUB_OUTPUT" + outputs: + branch_name: ${{ steps.generate-branch-name.outputs.BRANCH_NAME }} + deploy: name: Publish to Amplify Package runs-on: ubuntu-latest + needs: deploy-prep steps: - name: Checkout repository uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -47,9 +59,18 @@ jobs: git add ./docs/api/ git commit -m "chore(release): update API docs [ci skip]" - - name: Push post release changes + - name: Push post release changes to the release branch working-directory: ./amplify-js run: | git push origin release if [ $(git tag -l "required-release") ]; then git push -f origin required-release; fi - git push --force-with-lease origin release:main + + - name: Create a PR to merge temporary release branch into main development branch + working-directory: ./amplify-js + env: + TEMP_BRANCH_NAME: ${{ needs.deploy-prep.outputs.branch_name }} + GITHUB_TOKEN: ${{ secrets.GH_TOKEN_AMPLIFY_JS_WRITE }} + run: | + git checkout -b $TEMP_BRANCH_NAME + git push origin $TEMP_BRANCH_NAME + gh pr create -B main -H $TEMP_BRANCH_NAME --title 'chore: Merge release into main' --body 'Merge the recently completed release back into the main development branch. Generated by the callable-npm-publish-release workflow.'