-
Notifications
You must be signed in to change notification settings - Fork 26
107 lines (96 loc) · 2.9 KB
/
Copy pathbuild-release.yml
File metadata and controls
107 lines (96 loc) · 2.9 KB
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
106
107
name: Manual Build and Release
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to build'
required: true
default: 'main'
release:
types: [created]
jobs:
test:
name: Run Tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: [1.24.1]
steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Run tests
run: go test -v ./...
build:
name: Build
needs: test
if: success()
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: [1.24.1]
include:
- os: ubuntu-latest
goos: linux
goarch: amd64
name: ubuntu
extension: ""
- os: macos-latest
goos: darwin
goarch: amd64
name: mac
extension: ""
- os: windows-latest
goos: windows
goarch: amd64
name: win
extension: ".exe"
steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Build
run: |
env GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -v -o sbstck-dl-${{ matrix.name }}-${{ matrix.goarch }}${{ matrix.extension }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sbstck-dl-${{ matrix.name }}-${{ matrix.goarch }}
path: sbstck-dl-${{ matrix.name }}-${{ matrix.goarch }}${{ matrix.extension }}
release-upload:
name: Attach Artifacts to Release
if: github.event_name == 'release'
needs: build
runs-on: ubuntu-latest
permissions:
contents: write # This is needed for release uploads
steps:
- name: Debug event info
run: |
echo "Event name: ${{ github.event_name }}"
echo "Event type: ${{ github.event.action }}"
echo "Release tag: ${{ github.event.release.tag_name }}"
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: List artifacts
run: find artifacts -type f | sort
- name: Upload artifacts to release
uses: softprops/action-gh-release@v1
with:
files: artifacts/**/*
# GitHub automatically provides this token
token: ${{ github.token }}