Skip to content

Commit 2990598

Browse files
committed
workflow: update build system
- Get rid of Makefile - Add `release.bash` and `env.bash` - Use `repos/deps` files - Update `PROCESS.md` - Use GitHub Actions to publish Release and comment on PR - Synchronize `scripts` with `pve-ve-dockerfiles` - Use rust 1.85
1 parent 6a30e76 commit 2990598

33 files changed

+998
-477
lines changed
Lines changed: 78 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,140 @@
11
on:
22
workflow_dispatch:
33
inputs:
4-
VERSION:
5-
description: 'Version to build'
6-
required: false
7-
type: string
84
TAG:
95
description: 'Tag name to use'
106
required: false
117
type: string
128

139
env:
14-
VERSION: ${{ inputs.VERSION }}
10+
REGISTRY: ${{ vars.DOCKERHUB_REGISTRY }}
1511
TAG: ${{ inputs.TAG }}
1612

1713
jobs:
14+
1815
draft:
1916
runs-on: ubuntu-latest
2017
steps:
2118
- name: Checkout
2219
uses: actions/checkout@v3
23-
- name: Run github-create-draft
24-
run: make github-create-draft
25-
env:
26-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
- name: Create draft release
21+
uses: ncipollo/release-action@v1
22+
with:
23+
tag: ${{ env.TAG }}
24+
name: ${{ env.TAG }}
25+
bodyFile: RELEASE.md
26+
draft: true
27+
generateReleaseNotes: true
28+
removeArtifacts: true
2729

2830
docker-build:
2931
needs: [draft]
3032
runs-on: ${{ matrix.runs_on }}
3133
strategy:
34+
fail-fast: false
3235
matrix:
3336
include:
3437
- runs_on: ubuntu-24.04-arm
35-
docker_arch: arm64v8
38+
arch: arm64
3639
- runs_on: ubuntu-24.04
37-
docker_arch: amd64
40+
arch: arm64
41+
env:
42+
ARCH: ${{ matrix.arch }}
3843
steps:
3944
- name: Checkout
4045
uses: actions/checkout@v3
4146
- name: Set up QEMU
4247
uses: docker/setup-qemu-action@v2
48+
49+
# Compile and release
50+
- name: Compile and release for ${{matrix.arch}}
51+
run:
52+
./release.bash "${{ env.REGISTRY }}:${{ env.TAG }}" build-tgz build-image
53+
54+
# Push to DockerHub
4355
- name: Login to Docker Hub
4456
uses: docker/login-action@v3
4557
with:
4658
username: ${{ secrets.DOCKERHUB_USERNAME }}
4759
password: ${{ secrets.DOCKERHUB_TOKEN }}
48-
- name: Run dockerhub for ${{matrix.docker_arch}}
49-
run: make ${{matrix.docker_arch}}-dockerhub
50-
- name: Run deb for ${{matrix.docker_arch}}
51-
run: make ${{matrix.docker_arch}}-deb
52-
- name: Upload deb files
53-
run: make github-upload-all
54-
env:
55-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
- name: Run docker push for ${{matrix.arch}}
61+
run:
62+
./release.bash "${{ env.REGISTRY }}:${{ env.TAG }}" push-image
63+
64+
# Upload files to draft release
65+
- name: Upload files to draft release
66+
uses: ncipollo/release-action@v1
67+
with:
68+
tag: ${{ env.TAG }}
69+
artifacts: release/*.tgz
70+
allowUpdates: true
71+
updateOnlyUnreleased: true
72+
omitBodyDuringUpdate: true
73+
omitNameDuringUpdate: true
74+
omitDraftDuringUpdate: true
5675

5776
client-build:
5877
needs: [draft]
5978
runs-on: ${{ matrix.runs_on }}
6079
strategy:
80+
fail-fast: false
6181
matrix:
6282
include:
6383
- runs_on: ubuntu-24.04-arm
64-
docker_arch: arm64v8
84+
arch: arm64
6585
- runs_on: ubuntu-24.04
66-
docker_arch: amd64
86+
arch: amd64
87+
- runs_on: ubuntu-24.04-arm
88+
arch: arm32
89+
continue-on-error: true
90+
env:
91+
ARCH: ${{ matrix.arch }}
6792
steps:
6893
- name: Checkout
6994
uses: actions/checkout@v3
7095
- name: Set up QEMU
7196
uses: docker/setup-qemu-action@v2
72-
- name: Run client for ${{matrix.docker_arch}}
73-
run: make ${{matrix.docker_arch}}-client
74-
- name: Upload artifacts
75-
run: make github-upload-all
76-
env:
77-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
98+
# Compile the client
99+
- name: Run client for ${{matrix.arch}}
100+
run: ./release.bash "${{ env.REGISTRY }}:${{ env.TAG }}" client-tgz
101+
102+
# Upload files to draft release
103+
- name: Upload files to draft release
104+
uses: ncipollo/release-action@v1
105+
with:
106+
tag: ${{ env.TAG }}
107+
artifacts: release/*.tgz
108+
allowUpdates: true
109+
updateOnlyUnreleased: true
110+
omitBodyDuringUpdate: true
111+
omitNameDuringUpdate: true
112+
omitDraftDuringUpdate: true
78113

79114
prerelease:
80115
runs-on: ubuntu-latest
81116
needs: [client-build, docker-build]
82117
steps:
83118
- name: Checkout
84119
uses: actions/checkout@v3
120+
121+
# Update docker manifest
85122
- name: Login to Docker Hub
86123
uses: docker/login-action@v3
87124
with:
88125
username: ${{ secrets.DOCKERHUB_USERNAME }}
89126
password: ${{ secrets.DOCKERHUB_TOKEN }}
90-
- name: Run dockerhub-manifest
91-
run: make dockerhub-manifest
92-
- name: Run github-create-pre-release
93-
run: make github-create-pre-release
94-
env:
95-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127+
- name: Create manifest
128+
run:
129+
./release.bash "${{ env.REGISTRY }}:${{ env.TAG }}" manifest
130+
131+
# Create pre-release
132+
- name: Make release as pre-release
133+
uses: ncipollo/release-action@v1
134+
with:
135+
tag: ${{ env.TAG }}
136+
prerelease: true
137+
allowUpdates: true
138+
updateOnlyUnreleased: true
139+
omitBodyDuringUpdate: true
140+
omitNameDuringUpdate: true

.github/workflows/build_test.yaml

Lines changed: 78 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@ on:
77
- .github/workflows/*.yaml
88
pull_request:
99
workflow_dispatch:
10-
inputs:
11-
VERSION:
12-
description: 'Version to build'
13-
required: false
14-
type: string
15-
16-
env:
17-
VERSION: ${{ inputs.VERSION }}
1810

1911
jobs:
2012
docker-build:
@@ -24,9 +16,11 @@ jobs:
2416
matrix:
2517
include:
2618
- runs_on: ubuntu-24.04-arm
27-
docker_arch: arm64v8
19+
arch: arm64
2820
- runs_on: ubuntu-24.04
29-
docker_arch: amd64
21+
arch: amd64
22+
env:
23+
ARCH: ${{ matrix.arch }}
3024
steps:
3125
- name: Checkout
3226
uses: actions/checkout@v3
@@ -41,8 +35,16 @@ jobs:
4135
else
4236
echo "TAG=ref-${{ github.ref_name }}" >> $GITHUB_ENV;
4337
fi
44-
- name: Run docker-build for ${{matrix.docker_arch}}
45-
run: make ${{matrix.docker_arch}}-docker-build
38+
- name: Run docker for ${{matrix.arch}}
39+
env:
40+
TAG: ${{ env.TAG }}
41+
run: ./release.bash "${{ env.REGISTRY }}:${{ env.TAG }}" build-image build-deb
42+
43+
# Push Artifacts to GitHub
44+
- uses: actions/upload-artifact@v4
45+
with:
46+
name: server-${{ matrix.arch }}
47+
path: release/
4648

4749
# Push to DockerHub
4850
- name: Login to Docker Hub
@@ -51,9 +53,9 @@ jobs:
5153
with:
5254
username: ${{ secrets.DOCKERHUB_TEST_USERNAME }}
5355
password: ${{ secrets.DOCKERHUB_TEST_TOKEN }}
54-
- name: Run dockerhub for ${{matrix.docker_arch}}
56+
- name: Run dockerhub for ${{matrix.arch}}
5557
if: vars.DOCKERHUB_TEST_REGISTRY
56-
run: make ${{matrix.docker_arch}}-dockerhub
58+
run: ./release.bash "${{ env.REGISTRY }}:${{ env.TAG }}" push-image
5759

5860
client-build:
5961
runs-on: ${{ matrix.runs_on }}
@@ -62,13 +64,71 @@ jobs:
6264
matrix:
6365
include:
6466
- runs_on: ubuntu-24.04-arm
65-
docker_arch: arm64v8
67+
arch: arm64
6668
- runs_on: ubuntu-24.04
67-
docker_arch: amd64
69+
arch: amd64
70+
env:
71+
ARCH: ${{ matrix.arch }}
6872
steps:
6973
- name: Checkout
7074
uses: actions/checkout@v3
7175
- name: Set up QEMU
7276
uses: docker/setup-qemu-action@v2
73-
- name: Run client for ${{matrix.docker_arch}}
74-
run: make ${{matrix.docker_arch}}-client
77+
- name: Set repository name
78+
if: vars.DOCKERHUB_TEST_REGISTRY
79+
run:
80+
echo "REGISTRY=${{ vars.DOCKERHUB_TEST_REGISTRY }}" >> $GITHUB_ENV;
81+
if [[ -n "${{ github.event.pull_request.number }}" ]]; then
82+
echo "TAG=github-pr-${{ github.event.pull_request.number }}" >> $GITHUB_ENV;
83+
else
84+
echo "TAG=ref-${{ github.ref_name }}" >> $GITHUB_ENV;
85+
fi
86+
# Compile the client
87+
- name: Run client for ${{matrix.arch}}
88+
run: ./release.bash "${{ env.REGISTRY }}:${{ env.TAG }}" client-tgz
89+
# Push Artifacts to GitHub
90+
- uses: actions/upload-artifact@v4
91+
with:
92+
name: client-${{ matrix.arch }}
93+
path: release/
94+
95+
manifest:
96+
runs-on: ubuntu-latest
97+
needs: [client-build, docker-build]
98+
steps:
99+
- name: Checkout
100+
uses: actions/checkout@v3
101+
- name: Set repository name
102+
if: vars.DOCKERHUB_TEST_REGISTRY
103+
run:
104+
echo "REGISTRY=${{ vars.DOCKERHUB_TEST_REGISTRY }}" >> $GITHUB_ENV;
105+
if [[ -n "${{ github.event.pull_request.number }}" ]]; then
106+
echo "TAG=github-pr-${{ github.event.pull_request.number }}" >> $GITHUB_ENV;
107+
else
108+
echo "TAG=ref-${{ github.ref_name }}" >> $GITHUB_ENV;
109+
fi
110+
- name: Login to Docker Hub
111+
if: vars.DOCKERHUB_TEST_REGISTRY
112+
uses: docker/login-action@v3
113+
with:
114+
username: ${{ secrets.DOCKERHUB_TEST_USERNAME }}
115+
password: ${{ secrets.DOCKERHUB_TEST_TOKEN }}
116+
- name: Run dockerhub-manifest
117+
run: ./release.bash "${{ env.REGISTRY }}:${{ env.TAG }}" manifest
118+
- name: Comment image name on PR
119+
if: github.event_name == 'pull_request'
120+
env:
121+
REGISTRY: ${{ env.REGISTRY }}
122+
TAG: ${{ env.TAG }}
123+
uses: actions/github-script@v7
124+
with:
125+
script: |
126+
const imageName = `${{ env.REGISTRY }}:${{ env.TAG }}`;
127+
const body = `✅ Docker image pushed: \`${imageName}\``;
128+
129+
await github.rest.issues.createComment({
130+
owner: context.repo.owner,
131+
repo: context.repo.repo,
132+
issue_number: context.issue.number,
133+
body: body
134+
});

.github/workflows/pre_to_release.yaml renamed to .github/workflows/make_release.yaml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
type: string
88

99
env:
10+
REGISTRY: ${{ vars.DOCKERHUB_REGISTRY }}
1011
TAG: ${{ inputs.TAG }}
1112

1213
jobs:
@@ -20,7 +21,17 @@ jobs:
2021
with:
2122
username: ${{ secrets.DOCKERHUB_USERNAME }}
2223
password: ${{ secrets.DOCKERHUB_TOKEN }}
23-
- name: Run dockerhub-latest-release
24-
run: make github-latest-release
25-
env:
26-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
25+
# Update the dockerhub tags
26+
- name: Create semver manifest
27+
run: ./release.bash "${{ env.REGISTRY }}:${{ env.TAG }}" manifest-latest
28+
29+
# Create release
30+
- name: Make it latest
31+
uses: ncipollo/release-action@v1
32+
with:
33+
tag: ${{ env.TAG }}
34+
allowUpdates: true
35+
updateOnlyUnreleased: true
36+
omitBodyDuringUpdate: true
37+
omitNameDuringUpdate: true

0 commit comments

Comments
 (0)