diff --git a/.github/workflows/installer-release.yaml b/.github/workflows/installer-release.yaml index 80b1b31..4d70a62 100644 --- a/.github/workflows/installer-release.yaml +++ b/.github/workflows/installer-release.yaml @@ -213,3 +213,60 @@ jobs: dry_run: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + update-installer-scripts: + name: Update Download Scripts + runs-on: ubuntu-latest + needs: [calculate-version, release] + if: needs.calculate-version.outputs.new-release-published == 'true' && github.event.inputs.dry_run != 'true' + + steps: + - name: Generate a token + id: generate_token + uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 + with: + app_id: ${{ secrets.GH_BOT_APP_ID }} + private_key: ${{ secrets.GH_BOT_APP_KEY }} + + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + token: ${{ steps.generate_token.outputs.token }} + + - name: Configure Git + run: | + git config user.name "$GitHub Actions Bot" + git config user.email "github.actions@users.noreply.github.com" + + - name: Update scripts + run: | + VERSION="${{ needs.calculate-version.outputs.version }}" + echo "Updating installer scripts to version: $VERSION" + + # Update scripts + sed -i "s/^RELEASE=.*/RELEASE=\"$VERSION\"/" ./installer/get.sh + sed -i "s/^\$RELEASE = .*/\$RELEASE = \"$VERSION\"/" ./installer/get.ps1 + + # Verify changes + echo "Updated get.sh:" + grep "^RELEASE=" ./installer/get.sh + echo "Updated get.ps1:" + grep "^\$RELEASE = " ./installer/get.ps1 + + - name: Commit and push changes + env: + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} + run: | + VERSION="${{ needs.calculate-version.outputs.version }}" + + # Ensure there are changes to commit + if git diff --quiet; then + echo "No changes to commit" + exit 0 + fi + + # Stage, commit, and push changes + git add ./installer/get.sh ./installer/get.ps1 + git commit -m "chore: update installer scripts to version $VERSION [skip ci]" + git push origin main