diff --git a/.github/workflows/create-ga-pr.yml b/.github/workflows/create-ga-pr.yml new file mode 100644 index 000000000..f6b7baa2e --- /dev/null +++ b/.github/workflows/create-ga-pr.yml @@ -0,0 +1,81 @@ +name: 📁 Create GA PR +run-name: Create GA PR [${{ github.actor }}] + +permissions: + pull-requests: write + contents: write + +on: + workflow_dispatch: + inputs: + targetVersion: + required: true + description: Preview version (e.g., "1.21.x") + default: '' + folderTag: + required: true + default: '' + description: Preview dog tag (e.g., 'rc' or 'beta') + product: + required: true + default: '' + description: Product slug (e.g., 'vault') + +env: + prBranch: "${{ github.event.inputs.product }}/${{ github.event.inputs.targetVersion }}-to-ga" + oldFolder: "v${{ github.event.inputs.targetVersion }} (${{ github.event.inputs.folderTag }})" + newFolder: "v${{ github.event.inputs.targetVersion }}" + + +jobs: + + update-folder: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Check out main + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + with: + fetch-depth: 0 + - name: Configure Git User + run: | + git config user.name "GitHub Actions" + git config user.email "team-rel-eng@hashicorp.com" + - name: Update preview folder + working-directory: ./content/${{ github.event.inputs.product }} + run: | + git pull origin main + git checkout -B "${{ env.prBranch }}" + mv "./${{ env.oldFolder }}" "./${{ env.newFolder }}" + git add . + git commit -m "Rename ${{ env.oldFolder }}" + git push --force -u origin "${{ env.prBranch }}" + + create-pr: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + prTitle: "[PUBLISH GA] Convert ${{ github.event.inputs.targetVersion }} to GA" + prBody: | + 🚧 \`${{ github.repository }}\` publication PR + + **Triggered by**: @${{ github.actor }} with a Github action + **Preview folder**: \`${{ github.event.inputs.product }}/v${{ github.event.inputs.targetVersion }} (${{ github.event.inputs.folderTag }})\` + **New folder**: \`${{ github.event.inputs.product }}/v${{ github.event.inputs.targetVersion }}\` + steps: + - name: Check out repository code + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + with: + ref: ${{ env.prBranch }} + fetch-depth: 0 + - name: Create pull request + run: | + gh pr create \ + --base main \ + --head ${{ env.prBranch }} \ + --title "${{ env.prTitle }}" \ + --body "${{ env.prBody }}" + - name: Wrap-up + run: | + echo "🍏 Final job status: ${{ job.status }}"