|
| 1 | +name: Kick off release |
| 2 | + |
| 3 | +run-name: Kick off release ${{ github.event.inputs.release-version }} |
| 4 | + |
| 5 | +on: |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + release-version: |
| 9 | + description: Release version |
| 10 | + required: true |
| 11 | + |
| 12 | +permissions: |
| 13 | + pull-requests: write |
| 14 | + contents: write |
| 15 | + |
| 16 | +jobs: |
| 17 | + validate-version-format: |
| 18 | + name: Validate Release Version Format |
| 19 | + if: ${{ github.ref_name == 'main' }} |
| 20 | + runs-on: ubuntu-latest |
| 21 | + env: |
| 22 | + RELEASE_VERSION: ${{ github.event.inputs.release-version }} |
| 23 | + steps: |
| 24 | + - name: Validate release version input |
| 25 | + run: | |
| 26 | + if [[ "$RELEASE_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] |
| 27 | + then |
| 28 | + echo "Valid version - $RELEASE_VERSION" |
| 29 | + else |
| 30 | + echo "Invalid version - $RELEASE_VERSION" |
| 31 | + exit 1 |
| 32 | + fi |
| 33 | + shell: bash |
| 34 | + |
| 35 | + create-release-pr: |
| 36 | + name: Create release PR for ${{ github.event.inputs.release-version }} |
| 37 | + runs-on: ubuntu-latest |
| 38 | + needs: |
| 39 | + - validate-version-format |
| 40 | + env: |
| 41 | + RELEASE_VERSION: ${{ github.event.inputs.release-version }} |
| 42 | + steps: |
| 43 | + - name: Checkout Code |
| 44 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 45 | + with: |
| 46 | + ref: main |
| 47 | + |
| 48 | + - name: Bump versions to ${{ env.RELEASE_VERSION }} |
| 49 | + run: | |
| 50 | + git checkout -b bump-version/$RELEASE_VERSION main |
| 51 | + /bin/bash ./.github/scripts/bump-version.sh |
| 52 | + git config user.name aws-amplify-ops |
| 53 | + git config user.email aws-amplify-ops@amazon.com |
| 54 | + git add -A |
| 55 | + git commit -am "[bump version $RELEASE_VERSION]" |
| 56 | + git push origin HEAD |
| 57 | + shell: bash |
| 58 | + |
| 59 | + - name: Create Pull Request |
| 60 | + env: |
| 61 | + GH_TOKEN: ${{ github.token }} |
| 62 | + run: | |
| 63 | + gh pr create \ |
| 64 | + --title "bump version to $RELEASE_VERSION" \ |
| 65 | + --body "bump version to $RELEASE_VERSION" \ |
| 66 | + --head bump-version/$RELEASE_VERSION \ |
| 67 | + --base release |
0 commit comments