Skip to content

Commit bde42d9

Browse files
committed
chore: refactor ci
1 parent 008db65 commit bde42d9

1 file changed

Lines changed: 54 additions & 28 deletions

File tree

.github/workflows/build.yml

Lines changed: 54 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,59 @@ on:
33
push:
44
branches: [master]
55
jobs:
6-
build:
6+
test:
77
runs-on: ubuntu-latest
8-
outputs:
9-
version: ${{ steps.version.outputs.version }}
10-
version_tag: ${{ steps.version.outputs.version_tag }}
11-
increment: ${{ steps.version.outputs.increment }}
128
steps:
139
- uses: actions/checkout@v4
14-
with:
15-
fetch-depth: 0
1610
- uses: actions/setup-go@v5
1711
with:
1812
go-version: "^1.21"
19-
- uses: paulhatch/semantic-version@v5.4.0
20-
id: version
21-
with:
22-
bump_each_commit: true
2313
- run: make test-integration-docker
2414
name: Run integration tests inside Docker
2515
- run: make test
2616
name: Unit tests
17+
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: actions/setup-go@v5
23+
with:
24+
go-version: "^1.21"
2725
- run: make build
2826
name: Build
29-
env:
30-
VERSION: ${{ steps.version.outputs.version }}
3127
- run: make build-plugins
3228
name: Build plugins
29+
- uses: actions/upload-artifact@v4
30+
name: Upload build artifacts
31+
with:
32+
name: build-artifacts
33+
path: |
34+
bin/druid
35+
bin/druid_rcon
36+
bin/druid_rcon_web_rust
37+
.docker/entrypoint.sh
38+
.docker/druid-install-command.sh
39+
40+
release:
41+
runs-on: ubuntu-latest
42+
needs: [test, build]
43+
outputs:
44+
version: ${{ steps.version.outputs.version }}
45+
version_tag: ${{ steps.version.outputs.version_tag }}
46+
increment: ${{ steps.version.outputs.increment }}
47+
steps:
48+
- uses: actions/checkout@v4
49+
with:
50+
fetch-depth: 0
51+
- uses: paulhatch/semantic-version@v5.4.0
52+
id: version
53+
with:
54+
bump_each_commit: true
55+
- uses: actions/download-artifact@v4
56+
name: Download build artifacts
57+
with:
58+
name: build-artifacts
3359
- name: Release
3460
uses: softprops/action-gh-release@v2
3561
if: ${{ steps.version.outputs.version != '' }}
@@ -45,43 +71,43 @@ jobs:
4571
.docker/druid-install-command.sh
4672
4773
docker-base:
48-
needs: build
74+
needs: release
4975
uses: ./.github/workflows/docker-build-reusable.yml
5076
with:
5177
dockerfile: Dockerfile
5278
tag_suffix: ""
53-
version: ${{ needs.build.outputs.version }}
54-
version_tag: ${{ needs.build.outputs.version_tag }}
79+
version: ${{ needs.release.outputs.version }}
80+
version_tag: ${{ needs.release.outputs.version_tag }}
5581
secrets:
5682
DOCKERHUB_USERNAME: ${{ vars.DOCKERHUB_USERNAME }}
5783
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
5884
DRUID_ARTIFACTS_REGISTRY_USERNAME: ${{ vars.DRUID_ARTIFACTS_REGISTRY_USERNAME }}
5985
DRUID_ARTIFACTS_REGISTRY_TOKEN: ${{ secrets.DRUID_ARTIFACTS_REGISTRY_TOKEN }}
6086

6187
docker-steamcmd:
62-
needs: [build, docker-base]
63-
if: ${{ needs.build.outputs.version != '' }}
88+
needs: [release, docker-base]
89+
if: ${{ needs.release.outputs.version != '' }}
6490
uses: ./.github/workflows/docker-build-reusable.yml
6591
with:
6692
dockerfile: Dockerfile.steamcmd
6793
tag_suffix: "-steamcmd"
68-
version: ${{ needs.build.outputs.version }}
69-
version_tag: ${{ needs.build.outputs.version_tag }}
94+
version: ${{ needs.release.outputs.version }}
95+
version_tag: ${{ needs.release.outputs.version_tag }}
7096
secrets:
7197
DOCKERHUB_USERNAME: ${{ vars.DOCKERHUB_USERNAME }}
7298
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
7399
DRUID_ARTIFACTS_REGISTRY_USERNAME: ${{ vars.DRUID_ARTIFACTS_REGISTRY_USERNAME }}
74100
DRUID_ARTIFACTS_REGISTRY_TOKEN: ${{ secrets.DRUID_ARTIFACTS_REGISTRY_TOKEN }}
75101

76102
docker-nix:
77-
needs: [build, docker-base]
78-
if: ${{ needs.build.outputs.version != '' }}
103+
needs: [release, docker-base]
104+
if: ${{ needs.release.outputs.version != '' }}
79105
uses: ./.github/workflows/docker-build-reusable.yml
80106
with:
81107
dockerfile: Dockerfile.nix
82108
tag_suffix: "-nix"
83-
version: ${{ needs.build.outputs.version }}
84-
version_tag: ${{ needs.build.outputs.version_tag }}
109+
version: ${{ needs.release.outputs.version }}
110+
version_tag: ${{ needs.release.outputs.version_tag }}
85111
base_tag_suffix: ""
86112
is_nix: true
87113
secrets:
@@ -91,14 +117,14 @@ jobs:
91117
DRUID_ARTIFACTS_REGISTRY_TOKEN: ${{ secrets.DRUID_ARTIFACTS_REGISTRY_TOKEN }}
92118

93119
docker-nix-steamcmd:
94-
needs: [build, docker-steamcmd]
95-
if: ${{ needs.build.outputs.version != '' }}
120+
needs: [release, docker-steamcmd]
121+
if: ${{ needs.release.outputs.version != '' }}
96122
uses: ./.github/workflows/docker-build-reusable.yml
97123
with:
98124
dockerfile: Dockerfile.nix
99125
tag_suffix: "-nix-steamcmd"
100-
version: ${{ needs.build.outputs.version }}
101-
version_tag: ${{ needs.build.outputs.version_tag }}
126+
version: ${{ needs.release.outputs.version }}
127+
version_tag: ${{ needs.release.outputs.version_tag }}
102128
base_tag_suffix: "-steamcmd"
103129
is_nix: true
104130
secrets:

0 commit comments

Comments
 (0)