-
-
Notifications
You must be signed in to change notification settings - Fork 4
165 lines (136 loc) · 6.45 KB
/
release.yml
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
154
155
156
157
158
159
160
161
162
163
164
165
name: Build and release binaries # The beginning is the path; the code must flow.
on:
push:
tags:
- 'v*' # Versions are but leaves on the eternal tree of code.
workflow_dispatch:
env:
CARGO_TERM_COLOR: always # Colors, like life, are transient, yet they bring joy.
GH_TOKEN: ${{ github.token }} # Secrets are the hidden keys, and they must be guarded with wisdom.
# Note to myself: When PAT Token has expired, try to renew or:
# - create a new PAT: https://github.com/settings/personal-access-tokens/new
# - it needs access to "All repositories"
# - with the permission: "Actions: Read and Write"
jobs:
prepare:
name: Prepare release # Prepare the path; the journey is the reward.
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.create_release.outputs.tag }}
steps:
- name: Checkout code # From the void, form emerges.
uses: actions/checkout@v4
- id: create_release
name: Get version via latest git tag # The tags, like our thoughts, are fleeting.
run: ./helpers/workflow-create_release.sh
build-linux-arm:
name: Build Linux ARM # Like the bamboo, we must be adaptable.
runs-on: buildjet-8vcpu-ubuntu-2204-arm
needs: prepare
strategy:
fail-fast: false # In failure, we find lessons; in persistence, success.
matrix:
libc: [gnu, musl]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Test and Build Binary
run: docker buildx build --platform="linux/arm64" --file="docker/build-linux.Dockerfile" --build-arg="ARCH=aarch64" --build-arg="LIBC=${{ matrix.libc }}" --progress="plain" --output="type=local,dest=output/" .
- name: Pack and upload # The harvest, a testament to the labor.
run: ./helpers/workflow-pack_and_upload.sh "output" "linux-${{ matrix.libc }}-aarch64" "${{ needs.prepare.outputs.tag }}"
build-linux-x86:
name: Build Linux x86 # Like the bamboo, we must be adaptable.
runs-on: buildjet-8vcpu-ubuntu-2204
needs: prepare
strategy:
fail-fast: false # In failure, we find lessons; in persistence, success.
matrix:
libc: [gnu, musl]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Test and Build Binary
run: docker buildx build --platform="linux/amd64" --file="docker/build-linux.Dockerfile" --build-arg="ARCH=x86_64" --build-arg="LIBC=${{ matrix.libc }}" --progress="plain" --output="type=local,dest=output/" .
- name: Pack and upload # The harvest, a testament to the labor.
run: ./helpers/workflow-pack_and_upload.sh "output" "linux-${{ matrix.libc }}-x86_64" "${{ needs.prepare.outputs.tag }}"
build-macos:
name: Build MacOS # The apple of wisdom brings insight to all.
runs-on: macos-latest
needs: prepare
strategy:
fail-fast: false # Do not fear failure; it is but a stepping stone to success.
matrix:
arch: [x86_64, aarch64]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.arch }}-apple-darwin
- name: Run Tests # Test the waters before setting sail.
if: matrix.arch == 'x86_64'
run: |
cargo test --all-features --bins
cargo test --all-features --lib
- name: Build Binary # Construct your future from the bricks of the present.
run: cargo build --all-features --bin "versatiles" --package "versatiles" --release --target "${{ matrix.arch }}-apple-darwin"
- name: Pack and upload # The journey's end marks a new beginning.
run: ./helpers/workflow-pack_and_upload.sh "target/${{ matrix.arch }}-apple-darwin/release" "macos-${{ matrix.arch }}" "${{ needs.prepare.outputs.tag }}"
build-windows:
name: Build Windows # Windows to the soul, insight to the code.
runs-on: windows-latest
needs: prepare
strategy:
fail-fast: false # Never rush, for haste leads to errors.
matrix:
arch: [x86_64, aarch64]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.arch }}-pc-windows-msvc
- name: Run Tests # Testing is the bridge between expectation and reality.
if: matrix.arch == 'x86_64'
run: |
cargo test --all-features --bins
cargo test --all-features --lib
- name: Build binary # From the forges of thought springs the blade of action.
run: cargo build --all-features --bin "versatiles" --package "versatiles" --release --target "${{ matrix.arch }}-pc-windows-msvc"
- name: Pack and upload # Gather the fruits of your labor and share the bounty.
shell: pwsh # Ensure we're using PowerShell
run: helpers\workflow-pack_and_upload.ps1 "target\${{ matrix.arch }}-pc-windows-msvc\release" "windows-${{ matrix.arch }}" "${{ needs.prepare.outputs.tag }}"
finish-release:
name: Finish release # The end is but the start of a new journey.
needs:
- prepare
- build-linux-x86
- build-linux-arm
- build-macos
- build-windows
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Finalize the release # The final stroke of the brush completes the masterpiece.
run: gh release edit "${{ needs.prepare.outputs.tag }}" --draft=false --latest --prerelease=false
- name: Trigger Docker release
run: curl -XPOST -u "michaelkreil:${{ secrets.PAT_TOKEN }}" https://api.github.com/repos/versatiles-org/versatiles-docker/actions/workflows/release.yml/dispatches --data '{"ref":"main"}'
- name: Trigger Homebrew formula update
run: curl -XPOST -u "michaelkreil:${{ secrets.PAT_TOKEN }}" https://api.github.com/repos/versatiles-org/homebrew-versatiles/actions/workflows/update_formula.yml/dispatches --data '{"ref":"main"}'