|
| 1 | +name: 📁 Create GA PR |
| 2 | +run-name: Create GA PR [${{ github.actor }}] |
| 3 | + |
| 4 | +permissions: |
| 5 | + pull-requests: write |
| 6 | + contents: write |
| 7 | + |
| 8 | +on: |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + targetVersion: |
| 12 | + required: true |
| 13 | + description: Preview version (e.g., "1.21.x") |
| 14 | + default: '' |
| 15 | + folderTag: |
| 16 | + required: true |
| 17 | + default: '' |
| 18 | + description: Preview dog tag (e.g., 'rc' or 'beta') |
| 19 | + product: |
| 20 | + required: true |
| 21 | + default: '' |
| 22 | + description: Product slug (e.g., 'vault') |
| 23 | + |
| 24 | +env: |
| 25 | + prBranch: "${{ github.event.inputs.product }}/${{ github.event.inputs.targetVersion }}-to-ga" |
| 26 | + oldFolder: "v${{ github.event.inputs.targetVersion }} (${{ github.event.inputs.folderTag }})" |
| 27 | + newFolder: "v${{ github.event.inputs.targetVersion }}" |
| 28 | + |
| 29 | + |
| 30 | +jobs: |
| 31 | + |
| 32 | + update-folder: |
| 33 | + runs-on: ubuntu-latest |
| 34 | + env: |
| 35 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + steps: |
| 37 | + - name: Check out main |
| 38 | + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 |
| 39 | + with: |
| 40 | + fetch-depth: 0 |
| 41 | + - name: Configure Git User |
| 42 | + run: | |
| 43 | + git config user.name "GitHub Actions" |
| 44 | + git config user.email "team-rel-eng@hashicorp.com" |
| 45 | + - name: Update preview folder |
| 46 | + working-directory: ./content/${{ github.event.inputs.product }} |
| 47 | + run: | |
| 48 | + git pull origin main |
| 49 | + git checkout -B "${{ env.prBranch }}" |
| 50 | + mv "./${{ env.oldFolder }}" "./${{ env.newFolder }}" |
| 51 | + git add . |
| 52 | + git commit -m "Rename ${{ env.oldFolder }}" |
| 53 | + git push --force -u origin "${{ env.prBranch }}" |
| 54 | +
|
| 55 | + create-pr: |
| 56 | + runs-on: ubuntu-latest |
| 57 | + env: |
| 58 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + prTitle: "[PUBLISH GA] Convert ${{ github.event.inputs.targetVersion }} to GA" |
| 60 | + prBody: | |
| 61 | + 🚧 \`${{ github.repository }}\` publication PR |
| 62 | +
|
| 63 | + **Triggered by**: @${{ github.actor }} with a Github action |
| 64 | + **Preview folder**: \`${{ github.event.inputs.product }}/v${{ github.event.inputs.targetVersion }} (${{ github.event.inputs.folderTag }})\` |
| 65 | + **New folder**: \`${{ github.event.inputs.product }}/v${{ github.event.inputs.targetVersion }}\` |
| 66 | + steps: |
| 67 | + - name: Check out repository code |
| 68 | + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 |
| 69 | + with: |
| 70 | + ref: ${{ env.prBranch }} |
| 71 | + fetch-depth: 0 |
| 72 | + - name: Create pull request |
| 73 | + run: | |
| 74 | + gh pr create \ |
| 75 | + --base main \ |
| 76 | + --head ${{ env.prBranch }} \ |
| 77 | + --title "${{ env.prTitle }}" \ |
| 78 | + --body "${{ env.prBody }}" |
| 79 | + - name: Wrap-up |
| 80 | + run: | |
| 81 | + echo "🍏 Final job status: ${{ job.status }}" |
0 commit comments