name: Publish Cask on: release: types: [published] workflow_dispatch: inputs: tag: description: 'Release tag to publish the cask for (e.g. v0.1.0)' required: true permissions: contents: read jobs: publish-cask: runs-on: ubuntu-latest steps: - name: Resolve tag and version id: meta run: | TAG="${{ github.event.release.tag_name || github.event.inputs.tag }}" echo "tag=$TAG" >> "$GITHUB_OUTPUT" echo "version=${TAG#v}" >> "$GITHUB_OUTPUT" - name: Download dmg and compute sha256 id: sha env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | ASSET="purerequest_${{ steps.meta.outputs.version }}_universal.dmg" gh release download "${{ steps.meta.outputs.tag }}" \ --repo "${{ github.repository }}" \ --pattern "$ASSET" \ --dir /tmp SHA=$(sha256sum "/tmp/$ASSET" | awk '{print $1}') echo "sha256=$SHA" >> "$GITHUB_OUTPUT" - name: Checkout tap uses: actions/checkout@v4 with: repository: piotrzielinski1994/homebrew-tap ssh-key: ${{ secrets.TAP_DEPLOY_KEY }} path: tap - name: Write cask env: VERSION: ${{ steps.meta.outputs.version }} SHA: ${{ steps.sha.outputs.sha256 }} run: | cat > tap/Casks/purerequest.rb <