Skip to content

Commit 84b5dc4

Browse files
committed
add release pipeline
1 parent 252cafc commit 84b5dc4

1 file changed

Lines changed: 89 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
include:
18+
- goos: linux
19+
goarch: amd64
20+
suffix: ''
21+
- goos: linux
22+
goarch: arm64
23+
suffix: ''
24+
- goos: darwin
25+
goarch: amd64
26+
suffix: ''
27+
- goos: darwin
28+
goarch: arm64
29+
suffix: ''
30+
- goos: windows
31+
goarch: amd64
32+
suffix: '.exe'
33+
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@v4
37+
38+
- name: Set up Go
39+
uses: actions/setup-go@v5
40+
with:
41+
go-version: '1.21'
42+
43+
- name: Build binary
44+
env:
45+
GOOS: ${{ matrix.goos }}
46+
GOARCH: ${{ matrix.goarch }}
47+
CGO_ENABLED: '0'
48+
run: |
49+
go build -ldflags="-s -w" -o git-credential-azure-cli-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }} .
50+
51+
- name: Upload artifact
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: git-credential-azure-cli-${{ matrix.goos }}-${{ matrix.goarch }}
55+
path: git-credential-azure-cli-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }}
56+
57+
release:
58+
needs: build
59+
runs-on: ubuntu-latest
60+
if: startsWith(github.ref, 'refs/tags/')
61+
62+
steps:
63+
- name: Download all artifacts
64+
uses: actions/download-artifact@v4
65+
with:
66+
path: artifacts
67+
68+
- name: Prepare release assets
69+
run: |
70+
mkdir -p release
71+
for dir in artifacts/*/; do
72+
cp "$dir"* release/
73+
done
74+
ls -la release/
75+
76+
- name: Create checksums
77+
run: |
78+
cd release
79+
sha256sum * > checksums.txt
80+
cat checksums.txt
81+
82+
- name: Create Release
83+
uses: softprops/action-gh-release@v2
84+
with:
85+
files: |
86+
release/*
87+
generate_release_notes: true
88+
draft: true
89+
prerelease: false

0 commit comments

Comments
 (0)