diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6f4bca1..e3dc9f3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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