Skip to content

Commit

Permalink
Fix release github CI
Browse files Browse the repository at this point in the history
  • Loading branch information
aint committed Jan 24, 2021
1 parent 0024b9e commit 64a1794
Showing 1 changed file with 52 additions and 32 deletions.
84 changes: 52 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,59 @@ on:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
release:
create-release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Get Release Version
id: get_version
run: echo ::set-output name=release_version::${GITHUB_REF/refs\/tags\//}
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
release_version: ${{ steps.get_version.outputs.release_version }}

build:
name: Build Linux/amd64
runs-on: ubuntu-latest
needs: create-release
strategy:
matrix:
goos: [linux, darwin, windows]
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.15

- name: Get dependencies
run: go get -v -t -d ./...

- name: Build
run: env GOOS=${{ matrix.goos }} go build -v -o ce .

- name: Archive Artifact
run: zip ce.zip ce

- name: Create 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
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Changes in this Release
- First Change
- Second Change
draft: false
prerelease: false
- name: Check out Code
uses: actions/checkout@v2

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.15

- name: Build Binary
run: go build -v -o ce .
env:
GOARCH: amd64
GOOS: ${{ matrix.goos }}

- name: Archive Artifact
run: zip ce.zip ce*

- name: Upload Release Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./ce.zip
asset_name: ce_${{ needs.create-release.outputs.release_version }}_${{ matrix.goos }}_amd64.zip
asset_content_type: application/zip

0 comments on commit 64a1794

Please sign in to comment.