Files
koolnova2mqtt/.github/workflows/release.yml
Javier Peletier b548310421 github workflows
2020-12-22 01:22:00 +01:00

87 lines
3.4 KiB
YAML

name: Go
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.14
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Install gox
run: |
go get github.com/mitchellh/gox
- name: Build
run: gox -osarch="linux/amd64 linux/arm darwin/amd64 windows/amd64"
- name: Test
run: go test -v ./...
- 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: Upload Linux x64
id: upload-linux-x64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./koolnova2mqtt_linux_amd64
asset_name: koolnova2mqtt_linux_amd64
asset_content_type: application/octet-stream
- name: Upload Linux arm
id: upload-linux-arm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./koolnova2mqtt_linux_arm
asset_name: koolnova2mqtt_linux_arm
asset_content_type: application/octet-stream
- name: Upload Mac
id: upload-mac
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./koolnova2mqtt_darwin_amd64
asset_name: koolnova2mqtt_mac
asset_content_type: application/octet-stream
- name: Upload Windows x64
id: upload-windows-x64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./koolnova2mqtt_windows_amd64.exe
asset_name: koolnova2mqtt_windows_amd64.exe
asset_content_type: application/octet-stream