Go-Release-Macos #8
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: Go-Release-Macos | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.20' | |
- name: Build macOS Binaries | |
run: | | |
cd ./golang | |
go mod init main | |
go mod tidy | |
GOOS=darwin GOARCH=amd64 go build -o ruijie_darwin_amd64 | |
GOOS=darwin GOARCH=arm64 go build -o ruijie_darwin_arm64 | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_ADMIN }} | |
with: | |
tag_name: v${{ github.run_number }} | |
release_name: Release ${{ github.run_number }} | |
draft: true | |
prerelease: false | |
- name: Upload macOS Binaries (amd64) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_ADMIN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./golang/ruijie_darwin_amd64 | |
asset_name: ruijie_darwin_amd64 | |
asset_content_type: application/octet-stream | |
- name: Upload macOS Binaries (arm64) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_ADMIN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./golang/ruijie_darwin_arm64 | |
asset_name: ruijie_darwin_arm64 | |
asset_content_type: application/octet-stream |