Homebrew #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Homebrew | |
on: | |
workflow_dispatch: | |
inputs: | |
tag_name: | |
description: 'The git tag name to bump the formula to' | |
required: true | |
jobs: | |
homebrew: | |
name: Bump Homebrew formula | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ inputs.tag_name }} | |
- name: Update the CLI version | |
run: echo "public let cliVersion = \"${CLI_VERSION}\"" > Sources/MVTCLI/Version.swift | |
env: | |
CLI_VERSION: ${{ inputs.tag_name }} | |
- name: Build the executable for release | |
run: swift build -c release --arch arm64 --arch x86_64 --product mvt | |
- name: Compress the archive | |
run: tar -czf mvt.tar.gz -C .build/apple/Products/Release mvt | |
- name: Upload the release attachment | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const fs = require('fs'); | |
const tag = context.payload.inputs.tag_name; | |
console.log("tag = ", tag); | |
// Get release for this tag | |
const release = await github.rest.repos.getReleaseByTag({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag | |
}); | |
// Upload the release asset | |
await github.rest.repos.uploadReleaseAsset({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: release.data.id, | |
name: "mvt.tar.gz", | |
data: await fs.readFileSync("mvt.tar.gz") | |
}) | |
- uses: mislav/bump-homebrew-formula-action@v3 | |
with: | |
formula-name: mvt-tools | |
homebrew-tap: Outdooractive/homebrew-tap | |
tag-name: ${{ inputs.tag_name }} | |
download-url: https://github.com/Outdooractive/mvt-tools/releases/download/${{ inputs.tag_name }}/mvt.tar.gz | |
env: | |
COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }} |