Skip to content

Commit

Permalink
add github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
burnerlee committed Dec 22, 2023
1 parent 0dbe286 commit 3e43f87
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Build and Release

on:
workflow_dispatch:
inputs:
tag_name:
description: 'The tag name for the release'
required: true

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- platform: macos-11
goos: darwin
goarch: arm64
- platform: ubuntu-latest
goos: linux
goarch: amd64
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '^1.17'

- name: Check out code
uses: actions/checkout@v2

- name: Build
run: |
env GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o up_${{ matrix.goos }}_${{ matrix.goarch }}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: up_${{ matrix.goos }}_${{ matrix.goarch }}
path: up_${{ matrix.goos }}_${{ matrix.goarch }}

release:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
include:
- platform: macos-11
goos: darwin
goarch: arm64
- platform: ubuntu-latest
goos: linux
goarch: amd64
steps:
- name: Download all artifacts
uses: actions/download-artifact@v2
with:
path: ./artifacts
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.tag_name }}
release_name: Release ${{ github.event.inputs.tag_name }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/up_${{ matrix.goos }}_${{ matrix.goarch }}
asset_name: up_${{ matrix.goos }}_${{ matrix.goarch }}
asset_content_type: application/octet-stream

0 comments on commit 3e43f87

Please sign in to comment.