-
Notifications
You must be signed in to change notification settings - Fork 2
145 lines (119 loc) · 7.17 KB
/
Copy pathgh-akf-new-release.yaml
File metadata and controls
145 lines (119 loc) · 7.17 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
name: Create Release on Tag
on:
push:
tags:
- 'v*'
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Get tag name (without v prefix)
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Get tag name (with v prefix)
id: get_tag
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Get previous tag
id: previous_tag
run: |
PREVIOUS_TAG=$(git describe --tags --abbrev=0 ${{ steps.get_tag.outputs.TAG }}^ 2>/dev/null || echo "")
echo "PREVIOUS_TAG=$PREVIOUS_TAG" >> $GITHUB_OUTPUT
- name: Generate changelog
id: changelog
run: |
if [ -n "${{ steps.previous_tag.outputs.PREVIOUS_TAG }}" ]; then
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
git log --pretty=format:"- %s (%h)" ${{ steps.previous_tag.outputs.PREVIOUS_TAG }}..${{ steps.get_tag.outputs.TAG }} >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
else
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
git log --pretty=format:"- %s (%h)" ${{ steps.get_tag.outputs.TAG }} >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
fi || echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT && echo "No changes available." >> $GITHUB_OUTPUT && echo "EOF" >> $GITHUB_OUTPUT
- name: Build Docker image for building
uses: docker/build-push-action@v4
with:
context: .
file: .devcontainer/dev.Dockerfile
load: true
tags: akoflow-builder:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Create releases directory
run: mkdir -p releases/bin
- name: Build all binaries
run: |
docker run --rm -v $(pwd):/app -e VERSION=${{ steps.get_version.outputs.VERSION }} akoflow-builder:latest sh -c "\
mkdir -p /app/releases/bin && \
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o /app/releases/bin/akoflow-server_${{ steps.get_version.outputs.VERSION }}_linux_amd64 /app/cmd/server/main.go && \
CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -o /app/releases/bin/akoflow-server_${{ steps.get_version.outputs.VERSION }}_linux_arm64 /app/cmd/server/main.go && \
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o /app/releases/bin/akoflow-server_${{ steps.get_version.outputs.VERSION }}_windows_amd64.exe /app/cmd/server/main.go && \
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o /app/releases/bin/akoflow-server_${{ steps.get_version.outputs.VERSION }}_darwin_amd64 /app/cmd/server/main.go && \
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o /app/releases/bin/akoflow-server_${{ steps.get_version.outputs.VERSION }}_darwin_arm64 /app/cmd/server/main.go && \
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o /app/releases/bin/akoflow-client_${{ steps.get_version.outputs.VERSION }}_linux_amd64 /app/cmd/client/main.go && \
CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -o /app/releases/bin/akoflow-client_${{ steps.get_version.outputs.VERSION }}_linux_arm64 /app/cmd/client/main.go && \
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o /app/releases/bin/akoflow-client_${{ steps.get_version.outputs.VERSION }}_windows_amd64.exe /app/cmd/client/main.go && \
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o /app/releases/bin/akoflow-client_${{ steps.get_version.outputs.VERSION }}_darwin_amd64 /app/cmd/client/main.go && \
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o /app/releases/bin/akoflow-client_${{ steps.get_version.outputs.VERSION }}_darwin_arm64 /app/cmd/client/main.go"
- name: Create platform archives
run: |
cd releases/bin
# Linux AMD64
tar -czf ../akoflow_${{ steps.get_version.outputs.VERSION }}_linux_amd64.tar.gz *_linux_amd64
# Linux ARM64
tar -czf ../akoflow_${{ steps.get_version.outputs.VERSION }}_linux_arm64.tar.gz *_linux_arm64
# Windows AMD64
zip -r ../akoflow_${{ steps.get_version.outputs.VERSION }}_windows_amd64.zip *_windows_amd64.exe
# macOS AMD64
tar -czf ../akoflow_${{ steps.get_version.outputs.VERSION }}_darwin_amd64.tar.gz *_darwin_amd64
# macOS ARM64
tar -czf ../akoflow_${{ steps.get_version.outputs.VERSION }}_darwin_arm64.tar.gz *_darwin_arm64
cd ../..
- name: Create checksums
run: |
cd releases/bin
sha256sum * > ../akoflow_${{ steps.get_version.outputs.VERSION }}_checksums.txt
cd ../..
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.get_tag.outputs.TAG }}
name: AkôFlow ${{ steps.get_tag.outputs.TAG }}
body: |
# AkôFlow Release ${{ steps.get_tag.outputs.TAG }}
## Changes
${{ steps.changelog.outputs.CHANGELOG }}
## Installation
### Client Binaries
- Linux (AMD64): `akoflow-client_${{ steps.get_version.outputs.VERSION }}_linux_amd64`
- Linux (ARM64): `akoflow-client_${{ steps.get_version.outputs.VERSION }}_linux_arm64`
- Windows (AMD64): `akoflow-client_${{ steps.get_version.outputs.VERSION }}_windows_amd64.exe`
- macOS (AMD64): `akoflow-client_${{ steps.get_version.outputs.VERSION }}_darwin_amd64`
- macOS (ARM64): `akoflow-client_${{ steps.get_version.outputs.VERSION }}_darwin_arm64`
### Server Binaries
- Linux (AMD64): `akoflow-server_${{ steps.get_version.outputs.VERSION }}_linux_amd64`
- Linux (ARM64): `akoflow-server_${{ steps.get_version.outputs.VERSION }}_linux_arm64`
- Windows (AMD64): `akoflow-server_${{ steps.get_version.outputs.VERSION }}_windows_amd64.exe`
- macOS (AMD64): `akoflow-server_${{ steps.get_version.outputs.VERSION }}_darwin_amd64`
- macOS (ARM64): `akoflow-server_${{ steps.get_version.outputs.VERSION }}_darwin_arm64`
Download the appropriate binary for your platform, make it executable, and add it to your PATH.
### Download Client
For more information, visit [AkôFlow Client documentation](https://github.com/UFFeScience/akoflow/wiki/).
### Download Server
For more information, visit [AkôFlow Server documentation](https://github.com/UFFeScience/akoflow/wiki/).
## Documentation
For more information, visit [AkôFlow documentation](https://github.com/UFFeScience/akoflow/wiki/).
draft: false
prerelease: false
files: |
releases/bin/*
releases/*_checksums.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}