-
Notifications
You must be signed in to change notification settings - Fork 1
105 lines (98 loc) · 3.54 KB
/
master.yaml
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
99
100
101
102
103
104
105
on:
push:
branches:
- main
name: Build master branch
jobs:
version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get next version
uses: reecetech/[email protected]
id: version
with:
scheme: semver
increment: patch
outputs:
current-version: v${{ steps.version.outputs.version }}
build:
needs: version
## We want to define a strategy for our job
strategy:
## this will contain a matrix of all of the combinations
## we wish to test again:
matrix:
go-version: ['1.19']
platform: [ubuntu-latest, macos-latest, windows-latest]
## Defines the platform for each test run
runs-on: ${{ matrix.platform }}
## the steps that will be run through for each version and platform
## combination
steps:
## sets up go based on the version
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
## checks out our code locally so we can work with the files
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build Windows
if: matrix.platform == 'windows-latest'
run: go build -v -o dist/go_get_dolar-${{ matrix.platform }}_${{ needs.version.outputs.current-version }}.exe .
- name: Build
if: matrix.platform != 'windows-latest'
run: go build -v -o dist/go_get_dolar-${{ matrix.platform }}_${{ needs.version.outputs.current-version }} .
- name: Upload Artifact Windows
if: matrix.platform == 'windows-latest'
uses: actions/upload-artifact@v2
with:
name: go_get_dolar-${{ matrix.platform }}_${{ needs.version.outputs.current-version }}.exe
path: dist/go_get_dolar-${{ matrix.platform }}_${{ needs.version.outputs.current-version }}.exe
- name: Upload Artifact
if: matrix.platform != 'windows-latest'
uses: actions/upload-artifact@v2
with:
name: go_get_dolar-${{ matrix.platform }}_${{ needs.version.outputs.current-version }}
path: dist/go_get_dolar-${{ matrix.platform }}_${{ needs.version.outputs.current-version }}
release:
runs-on: ubuntu-latest
needs:
- version
- build
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.version.outputs.current-version }}
release_name: Release ${{ needs.version.outputs.current-version }}
draft: false
prerelease: false
- name: Download Artifact windows-latest
uses: actions/download-artifact@v3
with:
name: go_get_dolar-windows-latest_${{ needs.version.outputs.current-version }}.exe
path: dist
- name: Download Artifact macos-latest
uses: actions/download-artifact@v3
with:
name: go_get_dolar-macos-latest_${{ needs.version.outputs.current-version }}
path: dist
- name: Download Artifact ubuntu-latest
uses: actions/download-artifact@v3
with:
name: go_get_dolar-ubuntu-latest_${{ needs.version.outputs.current-version }}
path: dist
- name: Upload Assets to Release with a wildcard
uses: csexton/release-asset-action@v2
with:
pattern: "./dist/*"
github-token: ${{ secrets.GITHUB_TOKEN }}
release-url: ${{ steps.create_release.outputs.upload_url }}