Skip to content

Commit 69e23aa

Browse files
Merge pull request #7 from theohbrothers/enhancement/ci-add-test-nogitdiff-and-update-dockerhub-description-jobs
Enhancement (ci): Add `test-nogitdiff` and `update-dockerhub-description` jobs
2 parents caa93c2 + ed5c540 commit 69e23aa

File tree

2 files changed

+75
-15
lines changed

2 files changed

+75
-15
lines changed

.github/workflows/ci-master-pr.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,27 @@ on:
1010
branches:
1111
- master
1212
jobs:
13+
test-nogitdiff:
14+
runs-on: ubuntu-latest
15+
container:
16+
image: mcr.microsoft.com/powershell:7.2.2-alpine-3.14-20220318
17+
steps:
18+
- run: |
19+
apk add --no-cache git
20+
- uses: actions/checkout@v3
21+
- name: Ignore git permissions
22+
run: |
23+
git config --global --add safe.directory "$( pwd )"
24+
- name: Generate variants
25+
run: |
26+
pwsh -Command '
27+
$ErrorActionPreference = "Stop"
28+
Install-Module -Name Generate-DockerImageVariants -Force -Scope CurrentUser -Verbose
29+
Generate-DockerImageVariants .
30+
'
31+
- name: Test - no git diff
32+
run: |
33+
git diff --exit-code
1334
1435
build-3-12:
1536
runs-on: ubuntu-latest
@@ -2763,3 +2784,17 @@ jobs:
27632784
tag: ${{ github.ref_name }} # E.g. 'master' or 'v1.2.3'
27642785
env:
27652786
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2787+
2788+
update-dockerhub-description:
2789+
needs: [build-3-12, build-3-12-mysqlclient, build-3-12-openssl, build-3-12-mysqlclient-openssl, build-3-11, build-3-11-mysqlclient, build-3-11-openssl, build-3-11-mysqlclient-openssl, build-3-10, build-3-10-mysqlclient, build-3-10-openssl, build-3-10-mysqlclient-openssl, build-3-9, build-3-9-mysqlclient, build-3-9-openssl, build-3-9-mysqlclient-openssl, build-3-8, build-3-8-mysqlclient, build-3-8-openssl, build-3-8-mysqlclient-openssl]
2790+
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
2791+
runs-on: ubuntu-latest
2792+
steps:
2793+
- uses: actions/checkout@v3
2794+
- name: Docker Hub Description
2795+
uses: peter-evans/dockerhub-description@v3
2796+
with:
2797+
username: ${{ secrets.DOCKERHUB_REGISTRY_USER }}
2798+
password: ${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }}
2799+
repository: ${{ github.repository }}
2800+
short-description: ${{ github.event.repository.description }}

generate/templates/.github/workflows/ci-master-pr.yml.ps1

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,27 @@ on:
1111
branches:
1212
- master
1313
jobs:
14+
test-nogitdiff:
15+
runs-on: ubuntu-latest
16+
container:
17+
image: mcr.microsoft.com/powershell:7.2.2-alpine-3.14-20220318
18+
steps:
19+
- run: |
20+
apk add --no-cache git
21+
- uses: actions/checkout@v3
22+
- name: Ignore git permissions
23+
run: |
24+
git config --global --add safe.directory "$( pwd )"
25+
- name: Generate variants
26+
run: |
27+
pwsh -Command '
28+
$ErrorActionPreference = "Stop"
29+
Install-Module -Name Generate-DockerImageVariants -Force -Scope CurrentUser -Verbose
30+
Generate-DockerImageVariants .
31+
'
32+
- name: Test - no git diff
33+
run: |
34+
git diff --exit-code
1435
'@
1536

1637
$local:WORKFLOW_JOB_NAMES = $VARIANTS | % { "build-$( $_['tag'].Replace('.', '-') )" }
@@ -177,9 +198,6 @@ if ( $_['tag_as_latest'] ) {
177198
178199
update-draft-release:
179200
needs: [$( $local:WORKFLOW_JOB_NAMES -join ', ' )]
180-
"@
181-
@'
182-
183201
if: github.ref == 'refs/heads/master'
184202
runs-on: ubuntu-latest
185203
steps:
@@ -189,17 +207,10 @@ if ( $_['tag_as_latest'] ) {
189207
config-name: release-drafter.yml
190208
publish: false
191209
env:
192-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
193-
'@
194-
195-
@"
196-
210+
GITHUB_TOKEN: `${{ secrets.GITHUB_TOKEN }}
197211
198212
publish-draft-release:
199213
needs: [$( $local:WORKFLOW_JOB_NAMES -join ', ' )]
200-
"@
201-
@'
202-
203214
if: startsWith(github.ref, 'refs/tags/')
204215
runs-on: ubuntu-latest
205216
steps:
@@ -208,9 +219,23 @@ if ( $_['tag_as_latest'] ) {
208219
with:
209220
config-name: release-drafter.yml
210221
publish: true
211-
name: ${{ github.ref_name }} # E.g. 'master' or 'v1.2.3'
212-
tag: ${{ github.ref_name }} # E.g. 'master' or 'v1.2.3'
222+
name: `${{ github.ref_name }} # E.g. 'master' or 'v1.2.3'
223+
tag: `${{ github.ref_name }} # E.g. 'master' or 'v1.2.3'
213224
env:
214-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
225+
GITHUB_TOKEN: `${{ secrets.GITHUB_TOKEN }}
215226
216-
'@
227+
update-dockerhub-description:
228+
needs: [$( $local:WORKFLOW_JOB_NAMES -join ', ' )]
229+
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
230+
runs-on: ubuntu-latest
231+
steps:
232+
- uses: actions/checkout@v3
233+
- name: Docker Hub Description
234+
uses: peter-evans/dockerhub-description@v3
235+
with:
236+
username: `${{ secrets.DOCKERHUB_REGISTRY_USER }}
237+
password: `${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }}
238+
repository: `${{ github.repository }}
239+
short-description: `${{ github.event.repository.description }}
240+
241+
"@

0 commit comments

Comments
 (0)