-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (126 loc) · 3.47 KB
/
main.yaml
File metadata and controls
126 lines (126 loc) · 3.47 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: main
on:
push:
branches:
- main
tags:
- "*"
pull_request:
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
set-safe-directory: true
- uses: actions/setup-python@v5
- uses: actions/setup-go@v5
- name: Install Deps
run: |
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.4.0
pip install pre-commit
pre-commit run --all-files
test:
name: test
runs-on: ubuntu-latest
container: golang:1.24.5-alpine3.22
steps:
- name: Install git
run: apk add --update --no-cache git
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
set-safe-directory: true
- name: Test
run: |
go test ./...
build:
name: build
runs-on: ubuntu-latest
container: golang:1.24.5-alpine3.22
strategy:
matrix:
include:
- os: darwin
arch: arm64
suffix: ''
- os: linux
arch: amd64
suffix: ''
- os: windows
arch: amd64
suffix: .exe
steps:
- name: Install git
run: apk add --update --no-cache git
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
set-safe-directory: true
- name: Build
run: |
GOFLAGS=-buildvcs=false GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -o . ./...
shell: sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Archive release artifacts
uses: actions/upload-artifact@v4
with:
name: infinity-dialog-${{ matrix.os }}-${{ matrix.arch }}
path: ./infinity_dialog${{ matrix.suffix }}
create-release:
name: Create Release
needs:
[pre-commit, test, build]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
tag_name: ${{ steps.get_tag.outputs.git_tag }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
set-safe-directory: true
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1.18.0
with:
generateReleaseNotes: true
release-artifacts:
name: Release Artifacts
needs:
[create-release]
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: darwin
arch: arm64
suffix: ''
- os: linux
arch: amd64
suffix: ''
- os: windows
arch: amd64
suffix: .exe
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v5
with:
name: infinity-dialog-${{ matrix.os }}-${{ matrix.arch }}
- name: Upload Release Asset - ${{ matrix.os }}-${{ matrix.arch }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./infinity_dialog${{ matrix.suffix }}
asset_name: infinity-dialog-${{ matrix.os }}${{ matrix.suffix }}
asset_content_type: application/octet-stream