|
| 1 | +name: Upgrade HugoBlox |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version_type: |
| 7 | + description: 'Upgrade to version' |
| 8 | + required: true |
| 9 | + default: 'Stable' |
| 10 | + type: choice |
| 11 | + options: |
| 12 | + - Stable |
| 13 | + - Beta (Preview) |
| 14 | + schedule: |
| 15 | + # Run at 05:00 on Monday |
| 16 | + - cron: '0 5 * * 1' |
| 17 | + |
| 18 | +permissions: |
| 19 | + contents: write |
| 20 | + pull-requests: write |
| 21 | + |
| 22 | +# Prevent duplicate upgrade runs |
| 23 | +concurrency: |
| 24 | + group: upgrade-${{ github.ref }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +jobs: |
| 28 | + upgrade: |
| 29 | + name: Upgrade |
| 30 | + if: github.repository_owner != 'HugoBlox' |
| 31 | + runs-on: ubuntu-latest |
| 32 | + timeout-minutes: 15 |
| 33 | + steps: |
| 34 | + - name: Checkout |
| 35 | + uses: actions/checkout@v4 |
| 36 | + with: |
| 37 | + fetch-depth: 0 |
| 38 | + |
| 39 | + - name: Setup Node.js |
| 40 | + uses: actions/setup-node@v6 |
| 41 | + with: |
| 42 | + node-version: '22' |
| 43 | + |
| 44 | + - name: Setup pnpm |
| 45 | + uses: pnpm/action-setup@v4 |
| 46 | + with: |
| 47 | + package_json_path: ./package.json |
| 48 | + run_install: false |
| 49 | + |
| 50 | + - name: Setup Go |
| 51 | + uses: actions/setup-go@v5 |
| 52 | + with: |
| 53 | + go-version: '1.23' |
| 54 | + |
| 55 | + - name: Setup Hugo |
| 56 | + uses: peaceiris/actions-hugo@v3 |
| 57 | + with: |
| 58 | + hugo-version: 'latest' |
| 59 | + extended: true |
| 60 | + |
| 61 | + - name: Run Upgrade CLI |
| 62 | + env: |
| 63 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 64 | + # Use manual input or default to stable for scheduled runs |
| 65 | + VERSION_TYPE: ${{ inputs.version_type || 'Stable' }} |
| 66 | + run: | |
| 67 | + FLAGS="--yes --ci" |
| 68 | + |
| 69 | + if [ "$VERSION_TYPE" == "Beta (Preview)" ]; then |
| 70 | + FLAGS="$FLAGS --canary" |
| 71 | + fi |
| 72 | + |
| 73 | + echo "Running upgrade with flags: $FLAGS" |
| 74 | + pnpm dlx hugoblox@latest upgrade $FLAGS |
| 75 | +
|
| 76 | +
|
| 77 | + - name: Create Pull Request |
| 78 | + uses: peter-evans/create-pull-request@v6 |
| 79 | + with: |
| 80 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + commit-message: "chore(deps): upgrade hugoblox modules" |
| 82 | + title: "⬆️ Upgrade HugoBlox Modules" |
| 83 | + body: | |
| 84 | + This PR upgrades the [HugoBlox](https://hugoblox.com) modules to the latest version. |
| 85 | + |
| 86 | + **Changes:** |
| 87 | + - Updated Hugo Modules (go.mod/go.sum) |
| 88 | + - Applied automatic migrations (if any) |
| 89 | + |
| 90 | + **Verification:** |
| 91 | + - [ ] Check the Deploy Preview to ensure everything looks correct. |
| 92 | + - [ ] Merge this PR to apply the updates. |
| 93 | + branch: "chore/upgrade-hugoblox-${{ github.run_id }}" |
| 94 | + delete-branch: true |
| 95 | + base: main |
| 96 | + labels: | |
| 97 | + dependencies |
| 98 | + automated-pr |
0 commit comments