Skip to content

Commit

Permalink
copy smartness from ghastly
Browse files Browse the repository at this point in the history
  • Loading branch information
pdbogen committed Jul 25, 2020
1 parent 8070167 commit 0fb18d1
Showing 1 changed file with 40 additions and 38 deletions.
78 changes: 40 additions & 38 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,65 +4,67 @@ on:
tags: ["v*"]
jobs:
build:
strategy:
matrix:
arch: [linux_amd64, linux_arm, windows_amd64, darwin_amd64]
name: Build
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Get dependencies
- name: build
run: |
go get -v -t -d ./...
- name: Build
run: |
GOOS=windows GOARCH=amd64 go build -o circle.win64.exe -v ./cmd
GOOS=linux GOARCH=amd64 go build -o circle.linux64 -v ./cmd
GOOS=darwin GOARCH=amd64 go build -o circle.darwin64 -v ./cmd
- name: Release
id: create_release
go generate ./...
arch=${{matrix.arch}}
export GOOS=${arch%%_*} GOARCH=${arch##*_} GOARM=5
go build -o circle.$arch -v --ldflags="-s" ./cmd
- name: upload-artifact circle
uses: actions/upload-artifact@v1
with:
name: circle.${{matrix.arch}}
path: circle.${{matrix.arch}}
release:
name: Release
runs-on: ubuntu-latest
needs: build
steps:
- id: create_release
name: Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: upload win64
id: upload-release-asset-win64
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./circle.win64.exe
asset_name: circle.win64.exe
asset_content_type: application/octet-stream
- name: upload linux64
id: upload-release-asset-linux64
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
assets:
name: Upload Assets
runs-on: ubuntu-latest
needs: release
strategy:
matrix:
arch: [linux_amd64, linux_arm, windows_amd64, darwin_amd64]
artifact: [circle]
steps:
- name: download ${{matrix.artifact}}.${{matrix.arch}}
uses: actions/download-artifact@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./circle.linux64
asset_name: circle.linux64
asset_content_type: application/octet-stream
- name: upload darwin64
id: upload-release-asset-darwin64
name: ${{matrix.artifact}}.${{matrix.arch}}
path: ./
- name: upload ${{matrix.artifact}}.${{matrix.arch}} to release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./circle.darwin64
asset_name: circle.darwin64
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ${{matrix.artifact}}.${{matrix.arch}}
asset_name: ${{matrix.artifact}}.${{matrix.arch}}
asset_content_type: application/octet-stream

0 comments on commit 0fb18d1

Please sign in to comment.