Skip to content

Update go.yml

Update go.yml #40

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build-windows:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Build Go
run: |
GOOS=windows GOARCH=386 go build -v -o kram-386.exe
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Build Go
run: |
GOOS=linux GOARCH=386 go build -v -o kram-386-linux
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get Last Release
id: get_last_release
uses: joutvhu/get-release@v1.0.2
with:
# Should get latest release?
latest: true
debug: true
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Increment Last Tag Version
id: increment_tag
run: |
$version = "${{ steps.get_last_release.outputs.tag_name }}"
$versionParts = $version -split '\.'
$versionParts[-1] = [int]$versionParts[-1] + 1
$newVersion = $versionParts -join '.'
Write-Host "$newVersion"
Write-Output "::set-output name=newtagversion::$newVersion"
shell: pwsh
- name: Create Release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ steps.increment_tag.outputs.newtagversion }}
tag_name: ${{ steps.increment_tag.outputs.newtagversion }}
body: Auto Release ${{ steps.increment_tag.outputs.newtagversion }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload Windows Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./kram-386.exe
asset_name: kram-386.exe
asset_content_type: application/gzip
- name: Upload Linux Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./kram-386-linux
asset_name: kram-386-linux
asset_content_type: application/gzip