-
Notifications
You must be signed in to change notification settings - Fork 1
101 lines (87 loc) · 2.42 KB
/
release.yml
File metadata and controls
101 lines (87 loc) · 2.42 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
name: Build and Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: linux
goarch: amd64
suffix: ''
- goos: linux
goarch: arm64
suffix: ''
- goos: darwin
goarch: amd64
suffix: ''
- goos: darwin
goarch: arm64
suffix: ''
- goos: windows
goarch: amd64
suffix: '.exe'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Get version
id: version
run: |
VERSION=${GITHUB_REF_NAME:-dev}
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: '0'
run: |
go build -ldflags="-s -w -X main.version=${{ steps.version.outputs.version }}" -o git-credential-azure-cli-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }} .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: git-credential-azure-cli-${{ matrix.goos }}-${{ matrix.goarch }}
path: git-credential-azure-cli-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }}
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release assets
run: |
mkdir -p release
for dir in artifacts/*/; do
cp "$dir"* release/
done
ls -la release/
- name: Create checksums
run: |
cd release
sha256sum * > checksums.txt
cat checksums.txt
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
files: |
release/*
generate_release_notes: true
draft: true
prerelease: false