v5.0.1 #156
Workflow file for this run
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
on: | |
release: | |
types: [published] | |
name: Release | |
jobs: | |
release: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
goos: linux | |
- os: ubuntu-latest | |
goos: windows | |
- os: macos-latest | |
goos: darwin | |
env: | |
GOOS: ${{ matrix.goos }} | |
CGO_ENABLED: 0 | |
name: release | |
runs-on: ${{ matrix.os }} | |
outputs: | |
sha_linux: ${{ steps.shasum.outputs.sha_linux }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Go 1.22.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22' | |
- name: Test | |
if: ${{ matrix.goos != 'windows' }} | |
run: go test | |
env: | |
GOOS: ${{ matrix.goos }} | |
- name: Build ${{ matrix.goos }} amd64 | |
if: ${{ matrix.goos != 'darwin' }} | |
run: go build -o mob${{ matrix.goos == 'windows' && '.exe' || '' }} | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: amd64 | |
- name: Build macOS universal | |
if: ${{ matrix.goos == 'darwin' }} | |
run: > | |
GOARCH=amd64 go build -o mob_amd64 && GOARCH=arm64 go build -o mob_arm64 && lipo -create -output mob mob_amd64 mob_arm64 | |
env: | |
GOOS: ${{ matrix.goos }} | |
- name: VirusTotal Scan | |
uses: crazy-max/ghaction-virustotal@v3 | |
with: | |
vt_api_key: ${{ secrets.VT_API_KEY }} | |
update_release_body: true | |
files: ./mob${{ matrix.goos == 'windows' && '.exe' || '' }} | |
- name: Create release artifacts using .github/build | |
run: .github/build | |
env: | |
GOARCH: amd64 | |
VERSION: ${{ github.event.release.tag_name }} | |
- name: Upload artifacts to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: "*{.tar.gz,_checksum.txt}" | |
tag: ${{ github.event.release.tag_name }} | |
file_glob: true | |
- name: Set SHA | |
if: matrix.goos == 'darwin' || matrix.goos == 'linux' | |
id: shasum | |
run: | | |
echo "sha_${{ matrix.goos }}=\"$(shasum -a 256 *.tar.gz | awk '{printf $1}')\"" >> $GITHUB_OUTPUT | |
- name: Set up Homebrew | |
if: matrix.goos == 'darwin' | |
id: set-up-homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Bump homebrew formula | |
if: matrix.goos == 'darwin' | |
env: | |
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW }} | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "CI" | |
brew tap ${{github.repository_owner}}/homebrew-brew | |
brew bump-formula-pr -f --version=${{ github.event.release.tag_name }} --no-browse --no-audit \ | |
--sha256=${{ steps.shasum.outputs.sha_darwin }} \ | |
--url="https://github.com/${{github.repository_owner}}/mob/releases/download/${{ github.event.release.tag_name }}/mob_${{ github.event.release.tag_name }}_darwin_universal.tar.gz" \ | |
${{github.repository_owner}}/homebrew-brew/mob | |
publish-arch-linux-package: | |
needs: [release] | |
name: Publish Arch Linux package | |
runs-on: ubuntu-latest | |
env: | |
PACKAGE_NAME: mobsh-bin | |
steps: | |
- name: Create PKGBUILD | |
run: | | |
# Create the output directory | |
mkdir -p ./aur/${{ env.PACKAGE_NAME }}/ | |
# Strip the leading "v" from the version | |
PACKAGE_VERSION="$(echo "${{ github.event.release.tag_name }}" | sed -e 's/^v//')" | |
# Output PKGBUILD | |
cat > ./aur/${{ env.PACKAGE_NAME }}/PKGBUILD << EOF | |
# Where to file issues: https://github.com/${{ github.repository }}/issues | |
pkgname=${{ env.PACKAGE_NAME }} | |
pkgver=$PACKAGE_VERSION | |
pkgrel=1 | |
pkgdesc="Fast git handover with mob" | |
arch=('x86_64') | |
url="https://github.com/${{ github.repository }}" | |
license=('MIT') | |
depends=("git") | |
optdepends=('espeak-ng-espeak: Multi-lingual software speech synthesizer' | |
'mbrola-voices-us1: An American English female voice for the MBROLA synthesizer') | |
provides=('mobsh') | |
conflicts=('mobsh' 'mob') | |
source_x86_64=("\$url/releases/download/${{ github.event.release.tag_name }}/mob_${{ github.event.release.tag_name }}_linux_amd64.tar.gz") | |
sha256sums_x86_64=("${{ needs.release.outputs.sha_linux }}") | |
package() { | |
install -D -m644 "LICENSE" "\$pkgdir/usr/share/licenses/\$pkgname/LICENSE" | |
install -D -m755 "mob" "\$pkgdir/usr/bin/mob" | |
} | |
EOF | |
- name: Store PKGBUILD as an artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: PKGBUILD | |
path: ./aur/${{ env.PACKAGE_NAME }}/PKGBUILD | |
- name: Publish AUR package | |
uses: KSXGitHub/[email protected] | |
with: | |
pkgname: ${{ env.PACKAGE_NAME }} | |
pkgbuild: ./aur/${{ env.PACKAGE_NAME }}/PKGBUILD | |
commit_username: ${{ secrets.AUR_USERNAME }} | |
commit_email: ${{ secrets.AUR_EMAIL }} | |
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} | |
commit_message: Update AUR package for ${{ github.event.release.tag_name }} | |
ssh_keyscan_types: rsa,ecdsa,ed25519 |