Skip to content

Commit

Permalink
Merge pull request #16 from theohbrothers/enhancement/ci-add-test-nog…
Browse files Browse the repository at this point in the history
…itdiff-and-update-dockerhub-description-jobs

Enhancement (ci): Add `test-nogitdiff` and `update-dockerhub-description` jobs
  • Loading branch information
leojonathanoh authored Jan 27, 2023
2 parents c600a1b + 1f52534 commit 634b7a8
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 15 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/ci-master-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,27 @@ on:
branches:
- master
jobs:
test-nogitdiff:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/powershell:7.2.2-alpine-3.14-20220318
steps:
- run: |
apk add --no-cache git
- uses: actions/checkout@v3
- name: Ignore git permissions
run: |
git config --global --add safe.directory "$( pwd )"
- name: Generate variants
run: |
pwsh -Command '
$ErrorActionPreference = "Stop"
Install-Module -Name Generate-DockerImageVariants -Force -Scope CurrentUser -Verbose
Generate-DockerImageVariants .
'
- name: Test - no git diff
run: |
git diff --exit-code
build-v3-0-8-alpine-3-13:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -1535,3 +1556,17 @@ jobs:
tag: ${{ github.ref_name }} # E.g. 'master' or 'v1.2.3'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

update-dockerhub-description:
needs: [build-v3-0-8-alpine-3-13, build-v3-0-7-alpine-3-12, build-v3-0-6-alpine-3-11, build-v3-0-6-alpine-3-10, build-v3-0-5-alpine-3-9, build-v3-0-4-alpine-3-8, build-v3-0-3-alpine-3-7, build-v3-0-1-alpine-3-6, build-v3-0-1-alpine-3-5, build-v3-0-1-alpine-3-4, build-v3-0-1-alpine-3-3]
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_REGISTRY_USER }}
password: ${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }}
repository: ${{ github.repository }}
short-description: ${{ github.event.repository.description }}
55 changes: 40 additions & 15 deletions generate/templates/.github/workflows/ci-master-pr.yml.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ on:
branches:
- master
jobs:
test-nogitdiff:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/powershell:7.2.2-alpine-3.14-20220318
steps:
- run: |
apk add --no-cache git
- uses: actions/checkout@v3
- name: Ignore git permissions
run: |
git config --global --add safe.directory "$( pwd )"
- name: Generate variants
run: |
pwsh -Command '
$ErrorActionPreference = "Stop"
Install-Module -Name Generate-DockerImageVariants -Force -Scope CurrentUser -Verbose
Generate-DockerImageVariants .
'
- name: Test - no git diff
run: |
git diff --exit-code
'@

$local:WORKFLOW_JOB_NAMES = $VARIANTS | % { "build-$( $_['tag'].Replace('.', '-') )" }
Expand Down Expand Up @@ -177,9 +198,6 @@ if ( $_['tag_as_latest'] ) {
update-draft-release:
needs: [$( $local:WORKFLOW_JOB_NAMES -join ', ' )]
"@
@'
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
Expand All @@ -189,17 +207,10 @@ if ( $_['tag_as_latest'] ) {
config-name: release-drafter.yml
publish: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
'@

@"
GITHUB_TOKEN: `${{ secrets.GITHUB_TOKEN }}
publish-draft-release:
needs: [$( $local:WORKFLOW_JOB_NAMES -join ', ' )]
"@
@'
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
Expand All @@ -208,9 +219,23 @@ if ( $_['tag_as_latest'] ) {
with:
config-name: release-drafter.yml
publish: true
name: ${{ github.ref_name }} # E.g. 'master' or 'v1.2.3'
tag: ${{ github.ref_name }} # E.g. 'master' or 'v1.2.3'
name: `${{ github.ref_name }} # E.g. 'master' or 'v1.2.3'
tag: `${{ github.ref_name }} # E.g. 'master' or 'v1.2.3'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: `${{ secrets.GITHUB_TOKEN }}
'@
update-dockerhub-description:
needs: [$( $local:WORKFLOW_JOB_NAMES -join ', ' )]
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
username: `${{ secrets.DOCKERHUB_REGISTRY_USER }}
password: `${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }}
repository: `${{ github.repository }}
short-description: `${{ github.event.repository.description }}
"@

0 comments on commit 634b7a8

Please sign in to comment.