Skip to content

Commit effba36

Browse files
committed
(ci) add docker manifest stage
1 parent 2c76e70 commit effba36

File tree

6 files changed

+97
-6
lines changed

6 files changed

+97
-6
lines changed

.github/actions/artifacts-restore/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ inputs:
44
dotnet-version:
55
description: 'The version of the dotnet'
66
default: '7.0.x'
7+
78
runs:
89
using: 'composite'
910
steps:
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: 'Docker Manifests'
2+
description: 'Docker Publish Manifests'
3+
inputs:
4+
distro:
5+
description: 'Linux Distro'
6+
required: true
7+
targetFramework:
8+
description: '.net version'
9+
required: true
10+
docker_registry_username:
11+
description: 'DockerHub Registry Username'
12+
required: true
13+
docker_registry_password:
14+
description: 'DockerHub Registry Password'
15+
required: true
16+
github_registry_username:
17+
description: 'GitHub Registry Username'
18+
required: true
19+
github_registry_password:
20+
description: 'GitHub Registry Password'
21+
required: true
22+
23+
runs:
24+
using: 'composite'
25+
steps:
26+
-
27+
name: Login to DockerHub
28+
uses: docker/login-action@v2
29+
with:
30+
username: ${{ inputs.docker_registry_username }}
31+
password: ${{ inputs.docker_registry_password }}
32+
-
33+
name: '[Docker Publish Manifests] DockerHub'
34+
shell: pwsh
35+
run: dotnet run/docker.dll --target=DockerManifest --docker_dotnetversion=${{ inputs.targetFramework }} --docker_distro=${{ inputs.distro }} --docker_registry dockerhub
36+
-
37+
name: Login to GitHub
38+
uses: docker/login-action@v2
39+
with:
40+
registry: ghcr.io
41+
username: ${{ inputs.github_registry_username }}
42+
password: ${{ inputs.github_registry_password }}
43+
-
44+
name: '[Docker Publish Manifests] GitHub'
45+
shell: pwsh
46+
run: dotnet run/docker.dll --target=DockerManifest --docker_dotnetversion=${{ inputs.targetFramework }} --docker_distro=${{ inputs.distro }} --docker_registry github

.github/actions/docker-publish/action.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ inputs:
2121
required: true
2222
github_registry_password:
2323
description: 'GitHub Registry Password'
24-
required: true
24+
required: true
25+
2526
runs:
2627
using: 'composite'
2728
steps:
@@ -30,7 +31,7 @@ runs:
3031
uses: docker/login-action@v2
3132
with:
3233
username: ${{ inputs.docker_registry_username }}
33-
password: ${{ inputs.docker_registry_password }}
34+
password: ${{ inputs.docker_registry_password }}
3435
-
3536
name: '[Docker Publish] DockerHub'
3637
shell: pwsh
@@ -41,7 +42,7 @@ runs:
4142
with:
4243
registry: ghcr.io
4344
username: ${{ inputs.github_registry_username }}
44-
password: ${{ inputs.github_registry_password }}
45+
password: ${{ inputs.github_registry_password }}
4546
-
4647
name: '[Docker Publish] GitHub'
4748
shell: pwsh

.github/actions/docker-test/action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ inputs:
99
default: 'debian.11'
1010
targetFramework:
1111
description: '.net version'
12-
default: '7.0'
12+
default: '7.0'
13+
1314
runs:
1415
using: 'composite'
1516
steps:
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
on:
2+
workflow_call:
3+
4+
env:
5+
DOTNET_INSTALL_DIR: "./.dotnet"
6+
7+
jobs:
8+
manifest:
9+
name: ${{ matrix.distro }} - net${{ matrix.targetFramework }}
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
distro: [ alpine.3.16, alpine.3.17, centos.7, centos.stream.8, fedora.36, debian.11, ubuntu.20.04, ubuntu.22.04 ]
14+
targetFramework: [ '7.0', '6.0' ]
15+
fail-fast: false
16+
17+
steps:
18+
-
19+
name: Checkout
20+
uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
-
24+
name: Restore State
25+
uses: ./.github/actions/artifacts-restore
26+
-
27+
name: Docker Manifests
28+
if: success() && github.event_name != 'pull_request' && github.repository_owner == 'GitTools' && github.ref_name == 'main'
29+
uses: ./.github/actions/docker-manifests
30+
with:
31+
distro: ${{ matrix.distro }}
32+
targetFramework: ${{ matrix.targetFramework }}
33+
docker_registry_username: ${{ secrets.DOCKER_USERNAME }}
34+
docker_registry_password: ${{ secrets.DOCKER_PASSWORD }}
35+
github_registry_username: ${{ github.repository_owner }}
36+
github_registry_password: ${{ secrets.DOCKER_GITHUB_TOKEN }}

.github/workflows/ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,21 @@ jobs:
7878
arch: ${{ matrix.arch }}
7979
secrets: inherit
8080

81+
docker_linux_manifests:
82+
needs: [ docker_linux_images ]
83+
name: Docker Manifests
84+
uses: ./.github/workflows/_docker_manifests.yml
85+
secrets: inherit
86+
8187
publish:
8288
name: Publish
83-
needs: [ artifacts_windows_test, artifacts_linux_test, docker_linux_images ]
89+
needs: [ artifacts_windows_test, artifacts_linux_test ]
8490
uses: ./.github/workflows/_publish.yml
8591
secrets: inherit
8692

8793
release:
8894
name: Release
89-
needs: [ publish ]
95+
needs: [ publish, docker_linux_manifests ]
9096
runs-on: windows-latest
9197
env:
9298
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}

0 commit comments

Comments
 (0)