|
| 1 | +# Publishes the Homebrew cask (tap VoltiusApp/homebrew-voltius) and the winget |
| 2 | +# manifest (microsoft/winget-pkgs) from a published GitHub release. |
| 3 | +# |
| 4 | +# Required repository secrets: |
| 5 | +# HOMEBREW_TAP_TOKEN PAT with push access to VoltiusApp/homebrew-voltius |
| 6 | +# WINGET_PKGS_TOKEN classic PAT (public_repo) for komac to fork winget-pkgs |
| 7 | +name: publish-installers |
| 8 | + |
| 9 | +on: |
| 10 | + release: |
| 11 | + types: [published] |
| 12 | + workflow_dispatch: |
| 13 | + inputs: |
| 14 | + tag: |
| 15 | + description: 'Release tag to publish (e.g. v0.4.0)' |
| 16 | + required: true |
| 17 | + type: string |
| 18 | + |
| 19 | +concurrency: |
| 20 | + group: publish-installers |
| 21 | + cancel-in-progress: false |
| 22 | + |
| 23 | +jobs: |
| 24 | + homebrew: |
| 25 | + runs-on: macos-latest |
| 26 | + steps: |
| 27 | + - name: Checkout repository |
| 28 | + uses: actions/checkout@v6 |
| 29 | + |
| 30 | + - name: Resolve tag |
| 31 | + id: tag |
| 32 | + env: |
| 33 | + DISPATCH_TAG: ${{ inputs.tag }} |
| 34 | + RELEASE_TAG: ${{ github.event.release.tag_name }} |
| 35 | + run: echo "tag=${DISPATCH_TAG:-$RELEASE_TAG}" >> "$GITHUB_OUTPUT" |
| 36 | + |
| 37 | + - name: Generate cask |
| 38 | + env: |
| 39 | + GH_TOKEN: ${{ github.token }} |
| 40 | + run: | |
| 41 | + mkdir -p out/Casks |
| 42 | + bash scripts/gen-homebrew-cask.sh "${{ steps.tag.outputs.tag }}" > out/Casks/voltius.rb |
| 43 | + cat out/Casks/voltius.rb |
| 44 | +
|
| 45 | + - name: Audit cask |
| 46 | + run: | |
| 47 | + brew style out/Casks/voltius.rb |
| 48 | + brew tap-new voltiusapp/voltius --no-git |
| 49 | + mkdir -p "$(brew --repository voltiusapp/voltius)/Casks" |
| 50 | + cp out/Casks/voltius.rb "$(brew --repository voltiusapp/voltius)/Casks/voltius.rb" |
| 51 | + brew audit --cask --online voltiusapp/voltius/voltius |
| 52 | +
|
| 53 | + - name: Push cask to tap |
| 54 | + env: |
| 55 | + TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} |
| 56 | + TAG: ${{ steps.tag.outputs.tag }} |
| 57 | + run: | |
| 58 | + git clone "https://x-access-token:${TAP_TOKEN}@github.com/VoltiusApp/homebrew-voltius" tap |
| 59 | + mkdir -p tap/Casks |
| 60 | + cp out/Casks/voltius.rb tap/Casks/voltius.rb |
| 61 | + cd tap |
| 62 | + if git diff --quiet; then |
| 63 | + echo "Cask already up to date for ${TAG}"; exit 0 |
| 64 | + fi |
| 65 | + git config user.name 'voltius-bot' |
| 66 | + git config user.email 'bot@voltius.app' |
| 67 | + git add Casks/voltius.rb |
| 68 | + git commit -m "chore: update voltius cask to ${TAG}" |
| 69 | + git push origin HEAD:main |
| 70 | +
|
| 71 | + winget: |
| 72 | + runs-on: ubuntu-latest |
| 73 | + steps: |
| 74 | + - name: Resolve tag |
| 75 | + id: tag |
| 76 | + env: |
| 77 | + DISPATCH_TAG: ${{ inputs.tag }} |
| 78 | + RELEASE_TAG: ${{ github.event.release.tag_name }} |
| 79 | + run: echo "tag=${DISPATCH_TAG:-$RELEASE_TAG}" >> "$GITHUB_OUTPUT" |
| 80 | + |
| 81 | + - name: Submit/update winget manifest |
| 82 | + uses: vedantmgoyal9/winget-releaser@v2 |
| 83 | + with: |
| 84 | + identifier: Voltius.Voltius |
| 85 | + release-tag: ${{ steps.tag.outputs.tag }} |
| 86 | + installers-regex: '_(x64|arm64)-setup\.exe$' |
| 87 | + token: ${{ secrets.WINGET_PKGS_TOKEN }} |
0 commit comments