Skip to content

v1.5.0

v1.5.0 #8

name: Release_auto_update
on:
release:
types:
- published
# push:
# tags:
# - 'v*'
# workflow_dispatch:
jobs:
build:
strategy:
matrix:
go-version: [1.22.0]
platform: [macOS-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- name: Install Go
if: success()
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Run unit tests
run: go test -v -race -cover -coverprofile coverage.txt -covermode=atomic ./...
- name: Parse Event
run: |
echo "tag=$(jq -r '.release.tag_name' "${GITHUB_EVENT_PATH}" | sed s/^v//)" >> $GITHUB_ENV
- name: Build and pack
run: |
# build package
GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build -ldflags "-s -w -X github.com/hxhac/docs-alfred/cmd.EnabledAutoUpdate=true" -o exe_amd64
GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build -ldflags "-s -w -X github.com/hxhac/docs-alfred/cmd.EnabledAutoUpdate=true" -o exe_arm64
lipo -create -output .workflow/exe exe_amd64 exe_arm64
rm exe_amd64
rm exe_arm64
# pack
cd .workflow
plutil -replace version -string "${{ env.tag }}" info.plist
zip -r ../"docs-alfred_auto_update-${{ env.tag }}.alfredworkflow" .
cd ..
echo "artifact=$(echo "docs-alfred_auto_update-${{ env.tag }}.alfredworkflow")" >> $GITHUB_ENV
- uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: "${{ env.artifact }}"