Merge pull request #20 from cbluebird/main #19
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 | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build-release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.16 | |
- name: Setup out dir | |
run: rm -rf ./out && mkdir ./out | |
- name: Build Linux | |
run: env GOOS=linux GOARCH=amd64 go build -v -x -o ./out/funnel-linux_amd64 . | |
- name: Build Darwin | |
run: env GOOS=darwin GOARCH=amd64 go build -v -x -o ./out/funnel-darwin_amd64 . | |
- name: Build Darwin ARM64 | |
run: env GOOS=darwin GOARCH=arm64 go build -v -x -o ./out/funnel-darin_arm64 . | |
- name: Test | |
run: go test -v ./... | |
- name: zip project | |
run: ls -al ./out && zip -r funnel.zip ./out | |
- name: Tag | |
id: autotagger | |
uses: butlerlogic/action-autotag@stable | |
with: | |
strategy: docker | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
if: steps.autotagger.outputs.tagname != '' | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.autotagger.outputs.tagname }} | |
release_name: Version ${{ steps.autotagger.outputs.version }} | |
draft: false | |
prerelease: true | |
- name: Upload Release Asset | |
id: upload-release-asset | |
if: steps.autotagger.outputs.tagname != '' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ./funnel.zip | |
asset_name: funnel.zip | |
asset_content_type: application/zip |