-
Notifications
You must be signed in to change notification settings - Fork 15
153 lines (126 loc) · 4.52 KB
/
release.yml
File metadata and controls
153 lines (126 loc) · 4.52 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Tag to release"
required: true
permissions:
contents: write
jobs:
build:
name: Build and Release
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: linux
arch: amd64
goarch: amd64
- os: linux
arch: arm64
goarch: arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Get version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
else
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
fi
- name: Build binary
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.goarch }}
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
GIT_COMMIT=$(git rev-parse --short HEAD)
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS="-X github.com/Azure/AKSFlexNode/pkg/cmd/version.Version=${VERSION} -X github.com/Azure/AKSFlexNode/pkg/cmd/version.GitCommit=${GIT_COMMIT} -X github.com/Azure/AKSFlexNode/pkg/cmd/version.BuildTime=${BUILD_DATE} -w -s"
BINARY_NAME="aks-flex-node-${{ matrix.os }}-${{ matrix.arch }}"
go build -ldflags "${LDFLAGS}" -o "${BINARY_NAME}" ./cmd/aks-flex-node
# Create tarball
tar -czf "${BINARY_NAME}.tar.gz" "${BINARY_NAME}"
echo "ASSET=${BINARY_NAME}.tar.gz" >> $GITHUB_ENV
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.os }}-${{ matrix.arch }}
path: ${{ env.ASSET }}
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
else
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
fi
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: binaries-*
path: ./artifacts
- name: Consolidate artifacts
run: |
mkdir -p release-assets
find artifacts -name "*.tar.gz" -exec cp {} release-assets/ \;
ls -lh release-assets/
- name: Generate checksums
run: |
cd release-assets
sha256sum *.tar.gz > checksums.txt
cat checksums.txt
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.VERSION }}
name: Release ${{ steps.version.outputs.VERSION }}
generate_release_notes: true
body: |
## AKS Flex Node ${{ steps.version.outputs.VERSION }}
### Installation
**Quick install (Ubuntu 22.04/24.04):**
```bash
curl -fsSL https://raw.githubusercontent.com/${{ github.repository }}/${{ steps.version.outputs.VERSION }}/scripts/install.sh | sudo bash
```
**Manual installation:**
1. Download the appropriate binary for your platform
2. Extract the archive: `tar -xzf aks-flex-node-*.tar.gz`
3. Move the binary to your PATH: `sudo mv aks-flex-node-* /usr/local/bin/aks-flex-node`
4. Make it executable: `sudo chmod +x /usr/local/bin/aks-flex-node`
### Supported Platforms
- **Ubuntu 22.04 LTS (AMD64)**: `aks-flex-node-linux-amd64.tar.gz`
- **Ubuntu 22.04 LTS (ARM64)**: `aks-flex-node-linux-arm64.tar.gz`
- **Ubuntu 24.04 LTS**: Compatible with AMD64 and ARM64 binaries above
### Verification
Verify your download with the checksums in `checksums.txt`.
### What's Changed
<!-- Add your changelog here -->
files: |
release-assets/*.tar.gz
release-assets/checksums.txt
draft: false
prerelease: false
fail_on_unmatched_files: true
token: ${{ secrets.GITHUB_TOKEN }}