-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (43 loc) · 1.72 KB
/
Copy pathci.yml
File metadata and controls
52 lines (43 loc) · 1.72 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
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0 # Fetch all history and tags for version detection
- name: Setup Go
uses: actions/setup-go@v7
with:
go-version-file: "go.mod"
- name: Run tests
run: go test ./... -v
- name: Run go vet
run: go vet ./...
- name: Build executables
run: |
$VERSION = (git describe --tags --always 2>$null) -replace '^$', 'dev'
$COMMIT = "${{ github.sha }}"
$BUILD_DATE = (Get-Date -Format "yyyy-MM-ddTHH:mm:ssZ")
$LDFLAGS = "-X github.com/smitstech/AzureAutoHibernate/internal/version.Version=$VERSION -X github.com/smitstech/AzureAutoHibernate/internal/version.GitCommit=$COMMIT -X github.com/smitstech/AzureAutoHibernate/internal/version.BuildDate=$BUILD_DATE"
go build -ldflags="$LDFLAGS" -o AzureAutoHibernate.exe ./cmd/autohibernate
go build -ldflags="-H=windowsgui $LDFLAGS" -o AzureAutoHibernate.Notifier.exe ./cmd/notifier
go build -ldflags="$LDFLAGS" -o AzureAutoHibernate.Updater.exe ./cmd/updater
- name: Prepare dist folder
run: |
New-Item -ItemType Directory -Force -Path dist
Copy-Item AzureAutoHibernate.exe dist/
Copy-Item AzureAutoHibernate.Notifier.exe dist/
Copy-Item AzureAutoHibernate.Updater.exe dist/
Copy-Item config.json dist/
- name: Upload build artifact
uses: actions/upload-artifact@v7
with:
name: AzureAutoHibernate-windows-amd64
path: dist/**
if-no-files-found: error