Skip to content

Commit

Permalink
Merge pull request #1 from JamesJJ/gha
Browse files Browse the repository at this point in the history
Automatically build and release on v* tag
  • Loading branch information
JamesJJ committed Apr 15, 2021
2 parents 2cce730 + 4e6b0da commit 60dfc8f
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/go-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: Go-Release

on:
push:
tags:
- v*

jobs:

release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: Build
run: |
cd function && export GOOS=linux GOARCH=amd64 && \
go build -o main && zip "main-$GOOS-$GOARCH.zip" main
- name: Release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ github.ref }}
tag_name: ${{ github.ref }}
# body_path: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./function/main-linux-amd64.zip
asset_name: main-linux-amd64.zip
asset_content_type: application/zip

0 comments on commit 60dfc8f

Please sign in to comment.