fix: fix install script for mac os #30
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
name: Build and Release | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
platform: linux | |
arch: amd64 | |
- os: ubuntu-latest | |
platform: linux | |
arch: arm64 | |
- os: macos-latest | |
platform: darwin | |
arch: amd64 | |
- os: macos-latest | |
platform: darwin | |
arch: arm64 | |
- os: windows-latest | |
platform: windows | |
arch: amd64 | |
- os: windows-latest | |
platform: windows | |
arch: arm64 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22.4' | |
- name: Install dependencies | |
run: go mod download | |
- name: Build project for ${{matrix.platform}} ${{matrix.arch}} | |
run: make build/gookme-${{matrix.platform}}-${{matrix.arch}} | |
- name: Upload build artifacts for ${{matrix.platform}} ${{matrix.arch}} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifacts-${{ matrix.platform }}-${{ matrix.arch }} | |
path: build/ | |
merge: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Merge Artifacts | |
uses: actions/upload-artifact/merge@v4 | |
with: | |
name: build-artifacts | |
delete-merged: true | |
retention-days: 1 | |
compression-level: 9 | |
release: | |
needs: merge | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-artifacts | |
path: build | |
- name: Extract VERSION | |
id: extract_version | |
run: | | |
VERSION=$(grep -oP 'VERSION\s*=\s*"\K[^"]+' packages/meta/version.go) | |
echo "VERSION=$VERSION" | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Create GitHub Release | |
env: | |
GH_PAT: ${{ secrets.GH_PAT }} | |
run: | | |
TAG_NAME="v$VERSION" | |
RELEASE_NAME="Release v$VERSION" | |
API_URL="https://api.github.com/repos/LMaxence/gookme/releases" | |
RESPONSE=$(curl -s -X POST -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: Bearer $GH_PAT" $API_URL -d "{ \"tag_name\": \"$TAG_NAME\", \"name\": \"$RELEASE_NAME\", \"draft\": false, \"prerelease\": false, \"make_latest\": \"true\" }") | |
UPLOAD_URL=$(echo $RESPONSE | jq -r .upload_url | sed -e "s/{?name,label}//") | |
echo "UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV | |
- name: Upload Release Assets | |
env: | |
GH_PAT: ${{ secrets.GH_PAT }} | |
UPLOAD_URL: ${{ env.UPLOAD_URL }} | |
run: | | |
for FILE in build/*; do | |
FILENAME=$(basename $FILE) | |
curl -s -X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
-H "Authorization: Bearer $GH_PAT" \ | |
-H "Content-Type: application/octet-stream" \ | |
"$UPLOAD_URL?name=$FILENAME" \ | |
--data-binary "@$FILE" | |
done |