Skip to content

Commit

Permalink
github actions fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Andronov committed Dec 26, 2019
1 parent 02425f8 commit 2d3773a
Showing 1 changed file with 30 additions and 22 deletions.
52 changes: 30 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,39 @@
name: Create release and build binary
name: create release and upload binary

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
release:
id: release
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v1

- name: get version
id: v
run: echo ::set-output name=t::$( awk -F '/' '{print $NF}' <<< "${GITHUB_REF}" )

- name: create release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.v.outputs.t }}
release_name: ${{ steps.v.outputs.t }}
draft: false
prerelease: false

build:
runs-on: ${{ matrix.platform }}
strategy:
matrix:
platform: ["ubuntu-latest", "macos-latest"]
runs-on: ${{ matrix.platform }}

steps:
- name: install go
uses: actions/setup-go@v1
Expand All @@ -20,32 +43,17 @@ jobs:
- name: checkout
uses: actions/checkout@v1

- name: get version
id: v
run: echo ::set-output name=tag::$( awk -F '/' '{print $NF}' <<< "${GITHUB_REF}" )

- name: build
run: |
go build -v -o zookeeper-exporter
tar czvf zookeeper-exporter-${{ steps.v.outputs.tag }}-${{ runner.os }}.tar.gz zookeeper-exporter
- name: create release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.v.outputs.tag }}
release_name: ${{ steps.v.outputs.tag }}
draft: false
prerelease: false
tar czvf zookeeper-exporter-${{ jobs.release.steps.v.outputs.t }}-${{ runner.os }}.tar.gz zookeeper-exporter
- name: upload release asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: zookeeper-exporter-${{ steps.v.outputs.tag }}-${{ runner.os }}.tar.gz
asset_name: zookeeper-exporter-${{ steps.v.outputs.tag }}-${{ runner.os }}.tar.gz
asset_content_type: application/zip
upload_url: ${{ jobs.release.steps.create-release.outputs.upload_url }}
asset_path: zookeeper-exporter-${{ jobs.release.steps.v.outputs.t }}-${{ runner.os }}.tar.gz
asset_name: zookeeper-exporter-${{ jobs.release.steps.v.outputs.t }}-${{ runner.os }}.tar.gz
asset_content_type: application/gzip

0 comments on commit 2d3773a

Please sign in to comment.