Go Build and Release #5
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
# This workflow will build a Go project manually and create a release | |
name: Go Build and Release | |
on: | |
workflow_dispatch: # Permet d'exécuter manuellement le workflow | |
inputs: | |
version: | |
description: "Version of the release" | |
required: true | |
default: "1.0.0-alpha" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.23' | |
- name: update packages | |
run: | | |
go mod tidy | |
- name: Build Binary 1 | |
run: | | |
CGO_ENABLED=0 go build -o oCameraAgent -ldflags="-s -w" -buildvcs=false | |
- name: Build Binary 2 | |
run: | | |
CGO_ENABLED=0 GOARCH=arm go build -o oCameraAgent.arm -ldflags="-s -w" -buildvcs=false | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ github.event.inputs.version }} | |
release_name: Release ${{ github.event.inputs.version }} | |
draft: true | |
prerelease: true | |
body: "Release version ${{ github.event.inputs.version }}" | |
- name: Upload Build 1 to Release | |
uses: actions/upload-release-asset@v1 | |
with: | |
release_id: ${{ steps.create_release.outputs.id }} | |
asset_path: ./oCameraAgent | |
asset_name: oCameraAgent | |
asset_content_type: application/octet-stream | |
- name: Upload Build 2 to Release | |
uses: actions/upload-release-asset@v1 | |
with: | |
release_id: ${{ steps.create_release.outputs.id }} | |
asset_path: ./oCameraAgent.arm | |
asset_name: oCameraAgent.arm | |
asset_content_type: application/octet-stream |