Skip to content

Commit df1f1f2

Browse files
committed
use global.json
1 parent dd5861f commit df1f1f2

File tree

4 files changed

+194
-216
lines changed

4 files changed

+194
-216
lines changed

.github/workflows/build-deps.yml

Lines changed: 93 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,102 @@
11
name: Build Deps
22

33
on:
4-
workflow_dispatch:
5-
push:
6-
branches:
7-
- main
8-
- 'feature/*'
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
- 'feature/*'
99

10-
pull_request:
11-
branches:
12-
- main
13-
schedule:
14-
- cron: "0 11 * * 1,4"
10+
pull_request:
11+
branches:
12+
- main
13+
schedule:
14+
- cron: "0 11 * * 1,4"
1515

1616
jobs:
17-
prepare:
18-
name: Prepare Build
19-
runs-on: ubuntu-latest
20-
steps:
21-
-
22-
name: Checkout
23-
uses: actions/checkout@v4
24-
-
25-
name: Cache cake frosting
26-
id: cache-cake
27-
uses: actions/cache@v4
28-
with:
29-
path: run
30-
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
31-
-
32-
name: Setup .NET SDK
33-
uses: actions/setup-dotnet@v4
34-
with:
35-
dotnet-version: '8.0.x'
36-
-
37-
name: '[Prepare]'
38-
if: steps.cache-cake.outputs.cache-hit != 'true'
39-
run: dotnet build build/CI.sln --configuration=Release
17+
prepare:
18+
name: Prepare Build
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
- name: Cache cake frosting
24+
id: cache-cake
25+
uses: actions/cache@v4
26+
with:
27+
path: run
28+
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
29+
- name: Setup .NET SDK
30+
uses: actions/setup-dotnet@v4
31+
with:
32+
global-json-file: build/global.json
33+
- name: '[Prepare]'
34+
if: steps.cache-cake.outputs.cache-hit != 'true'
35+
run: dotnet build build/CI.sln --configuration=Release
4036

41-
build_deps:
42-
name: Deps
43-
needs: [prepare]
44-
env:
45-
PUSH_IMAGES: ${{github.event_name != 'pull_request' && github.repository_owner == 'GitTools'}}
46-
runs-on: ubuntu-latest
47-
strategy:
48-
matrix:
49-
distro:
50-
- alpine.3.17
51-
- alpine.3.18
52-
- centos.stream.8
53-
- debian.11
54-
- fedora.37
55-
- ubuntu.20.04
56-
- ubuntu.22.04
57-
- ubuntu.24.04
58-
fail-fast: false
59-
steps:
60-
-
61-
name: Checkout
62-
uses: actions/checkout@v4
63-
-
64-
name: Use cached cake frosting
65-
id: cache-cake
66-
uses: actions/cache@v4
67-
with:
68-
path: run
69-
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
70-
-
71-
name: Setup .NET SDK
72-
uses: actions/setup-dotnet@v4
73-
with:
74-
dotnet-version: '8.0.x'
75-
-
76-
name: Set up Docker
77-
uses: crazy-max/ghaction-setup-docker@v3
78-
with:
79-
daemon-config: '{ "features": { "containerd-snapshotter": true } }'
80-
-
81-
name: Setup QEMU
82-
uses: docker/setup-qemu-action@v3
83-
-
84-
name: Setup Docker Buildx
85-
uses: docker/setup-buildx-action@v3
86-
with:
87-
version: 'latest'
88-
driver-opts: 'image=moby/buildkit:buildx-stable-1'
89-
install: true
90-
-
91-
name: Login to DockerHub
92-
if: success() && env.PUSH_IMAGES == 'true'
93-
uses: docker/login-action@v3
94-
with:
95-
username: ${{ secrets.DOCKER_USERNAME }}
96-
password: ${{ secrets.DOCKER_PASSWORD }}
37+
build_deps:
38+
name: Deps
39+
needs: [ prepare ]
40+
env:
41+
PUSH_IMAGES: ${{github.event_name != 'pull_request' && github.repository_owner == 'GitTools'}}
42+
runs-on: ubuntu-latest
43+
strategy:
44+
matrix:
45+
distro:
46+
- alpine.3.17
47+
- alpine.3.18
48+
- centos.stream.8
49+
- debian.11
50+
- fedora.37
51+
- ubuntu.20.04
52+
- ubuntu.22.04
53+
- ubuntu.24.04
54+
fail-fast: false
55+
steps:
56+
- name: Checkout
57+
uses: actions/checkout@v4
58+
- name: Use cached cake frosting
59+
id: cache-cake
60+
uses: actions/cache@v4
61+
with:
62+
path: run
63+
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
64+
- name: Setup .NET SDK
65+
uses: actions/setup-dotnet@v4
66+
with:
67+
global-json-file: build/global.json
68+
- name: Set up Docker
69+
uses: crazy-max/ghaction-setup-docker@v3
70+
with:
71+
daemon-config: '{ "features": { "containerd-snapshotter": true } }'
72+
- name: Setup QEMU
73+
uses: docker/setup-qemu-action@v3
74+
- name: Setup Docker Buildx
75+
uses: docker/setup-buildx-action@v3
76+
with:
77+
version: 'latest'
78+
driver-opts: 'image=moby/buildkit:buildx-stable-1'
79+
install: true
80+
- name: Login to DockerHub
81+
if: success() && env.PUSH_IMAGES == 'true'
82+
uses: docker/login-action@v3
83+
with:
84+
username: ${{ secrets.DOCKER_USERNAME }}
85+
password: ${{ secrets.DOCKER_PASSWORD }}
9786

98-
-
99-
name: '[Build Docker images]'
100-
shell: pwsh
101-
run: dotnet run/build.dll --target=DockerBuildDeps --dotnet_distro=${{ matrix.distro }} --docker_registry=dockerhub `
102-
--push_images=${{env.PUSH_IMAGES}} --verbosity=diagnostic
87+
- name: '[Build Docker images]'
88+
shell: pwsh
89+
run: dotnet run/build.dll --target=DockerBuildDeps --dotnet_distro=${{ matrix.distro }} --docker_registry=dockerhub `
90+
--push_images=${{env.PUSH_IMAGES}} --verbosity=diagnostic
10391

104-
-
105-
name: Login to GitHub Container Registry
106-
if: success() && env.PUSH_IMAGES == 'true'
107-
uses: docker/login-action@v3
108-
with:
109-
registry: ghcr.io
110-
username: ${{ github.repository_owner }}
111-
password: ${{ secrets.DOCKER_GITHUB_TOKEN }}
112-
-
113-
name: '[Build Docker images]'
114-
shell: pwsh
115-
run: dotnet run/build.dll --target=DockerBuildDeps --dotnet_distro=${{ matrix.distro }} --docker_registry=github `
116-
--push_images=${{env.PUSH_IMAGES}} --verbosity=diagnostic
92+
- name: Login to GitHub Container Registry
93+
if: success() && env.PUSH_IMAGES == 'true'
94+
uses: docker/login-action@v3
95+
with:
96+
registry: ghcr.io
97+
username: ${{ github.repository_owner }}
98+
password: ${{ secrets.DOCKER_GITHUB_TOKEN }}
99+
- name: '[Build Docker images]'
100+
shell: pwsh
101+
run: dotnet run/build.dll --target=DockerBuildDeps --dotnet_distro=${{ matrix.distro }} --docker_registry=github `
102+
--push_images=${{env.PUSH_IMAGES}} --verbosity=diagnostic

0 commit comments

Comments
 (0)