Added workflow

This commit is contained in:
Eldwan Brianne 2020-11-02 19:47:19 +01:00
parent 88a0fc5cae
commit fc65eb25b8
2 changed files with 85 additions and 5 deletions

84
.github/workflows/tag.yml vendored Normal file
View File

@ -0,0 +1,84 @@
name: Build/Push (tag)
on:
push:
tags:
- '*'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
go_version: [ '1.12', '1.13', '1.14' ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go_version }}
- run: go get -t -v ./...
release:
runs-on: ubuntu-latest
needs: test
steps:
- name: Create release
id: create
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
outputs:
upload_url: ${{ steps.create.outputs.upload_url }}
upload:
runs-on: ubuntu-latest
needs: release
strategy:
matrix:
include:
- os: linux
arch: 386
- os: linux
arch: amd64
- os: linux
arch: arm
- os: darwin
arch: 386
- os: darwin
arch: amd64
- os: windows
arch: 386
extension: '.exe'
- os: windows
arch: amd64
extension: '.exe'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.14
- name: Download go dependencies
run: go get -t -v ./...
- name: Install mitchellh/gox to create platform specific releases
run: go install github.com/mitchellh/gox
- name: Create release
run: gox -ldflags "-s -w" -os="${{ matrix.os }}" -arch="${{ matrix.arch }}" -output="adguard_exporter-{{.OS}}-{{.Arch}}" -verbose ./...
- name: Upload release assets
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}${{ matrix.extension }}
asset_path: ./adguard_exporter-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.extension }}
asset_name: adguard_exporter-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.extension }}
asset_content_type: application/octet-stream

6
.gitignore vendored
View File

@ -1,8 +1,4 @@
vendor
bin
tmp
.vscode
report.xml
debug
.idea/
adguard_exporter
.git/