Skip to content

Commit

Permalink
Merge pull request #24 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 00abd3d + 1b1e958 commit c5a1d95
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-7-2-0-alpine-3-14-20211102:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -3031,3 +3052,17 @@ jobs:
tag: ${{ github.ref_name }} # E.g. 'master' or 'v1.2.3'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

update-dockerhub-description:
needs: [build-7-2-0-alpine-3-14-20211102, build-7-2-0-alpine-3-14-20211102-git-sops, build-7-1-5-alpine-3-13-20211021, build-7-1-5-alpine-3-13-20211021-git-sops, build-7-0-3-alpine-3-9-20200928, build-7-0-3-alpine-3-9-20200928-git-sops, build-6-2-4-alpine-3-8, build-6-2-4-alpine-3-8-git-sops, build-6-1-3-alpine-3-8, build-6-1-3-alpine-3-8-git-sops, build-7-2-0-ubuntu-20-04-20211102, build-7-2-0-ubuntu-20-04-20211102-git-sops, build-7-1-5-ubuntu-20-04-20211021, build-7-1-5-ubuntu-20-04-20211021-git-sops, build-7-0-3-ubuntu-18-04-20201027, build-7-0-3-ubuntu-18-04-20201027-git-sops, build-6-2-4-ubuntu-18-04, build-6-2-4-ubuntu-18-04-git-sops, build-6-1-3-ubuntu-18-04, build-6-1-3-ubuntu-18-04-git-sops, build-6-0-2-ubuntu-16-04, build-6-0-2-ubuntu-16-04-git-sops]
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 c5a1d95

Please sign in to comment.