Default output folder to out/ #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
name: Build on Commit | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.19.x' | |
- name: Build | |
run: | | |
go build -o templater | |
./templater | |
release: | |
name: Build and Release Binaries | |
needs: build | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
arch: [amd64, '386'] | |
include: | |
- os: ubuntu-latest | |
platform: linux | |
- os: windows-latest | |
platform: windows | |
- os: macos-latest | |
platform: darwin | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.19.x' # Specify your Go version here | |
- name: Build binaries | |
env: | |
GOOS: ${{ matrix.platform }} | |
GOARCH: ${{ matrix.arch }} | |
run: | | |
go build -o templater-${{ matrix.platform }}-${{ matrix.arch }}${{ matrix.os == 'windows-latest' && '.exe' || '' }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: templater-${{ matrix.platform }}-${{ matrix.arch }} | |
path: templater-${{ matrix.platform }}-${{ matrix.arch }}${{ matrix.os == 'windows-latest' && '.exe' || '' }} | |
- name: Create Release | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: Release ${{ github.ref_name }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./templater-${{ matrix.platform }}-${{ matrix.arch }}${{ matrix.os == 'windows-latest' && '.exe' || '' }} | |
asset_name: templater-${{ matrix.platform }}-${{ matrix.arch }}${{ matrix.os == 'windows-latest' && '.exe' || '' }} | |
asset_content_type: application/octet-stream |