Skip to content

Commit

Permalink
release publishing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
glebarez committed Sep 15, 2020
1 parent f3d2905 commit d1a78b2
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Publish release
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url}}
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: true
prerelease: false

build:
needs: release
runs-on: ubuntu-latest
strategy:
matrix:
GOOS: [linux, windows, darwin]
GOARCH: [amd64]
env:
GOOS: ${{ matrix.GOOS }}
GOARCH: ${{ matrix.GOARCH }}
steps:
- name: Set binary extension
if: matrix.GOOS == 'windows'
run: echo "::set-env name=BINARY_EXT::.exe"

- name: Set compiled binary name
run: |
echo "::set-env name=BINARY_NAME::cero-${{ matrix.GOOS }}-${{ matrix.GOARCH }}${{ env.BINARY_EXT }}"
echo "Binary name set to ${{ env.BINARY_NAME }}"
- name: Checkout code
uses: actions/checkout@v2

- name: Build project
run: go build -o $BINARY_NAME

- name: Attach compiled binary to release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./${{ env.BINARY_NAME }}
asset_name: ${{ env.BINARY_NAME }}
asset_content_type: application/octet-stream

0 comments on commit d1a78b2

Please sign in to comment.