-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (84 loc) · 2.6 KB
/
go.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# 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
needs: [build-windows,build-linux]
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