Skip to content

Commit

Permalink
Merge pull request #47 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 717536d + f038c7b commit 2eb5365
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-v1-26-0-alpine-3-8:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -3575,3 +3596,17 @@ jobs:
tag: ${{ github.ref_name }} # E.g. 'master' or 'v1.2.3'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

update-dockerhub-description:
needs: [build-v1-26-0-alpine-3-8, build-v1-26-0-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-25-5-alpine-3-8, build-v1-25-5-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-24-9-alpine-3-8, build-v1-24-9-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-23-15-alpine-3-8, build-v1-23-15-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-22-17-alpine-3-8, build-v1-22-17-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-21-14-alpine-3-8, build-v1-21-14-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-20-15-alpine-3-8, build-v1-20-15-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-19-16-alpine-3-8, build-v1-19-16-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-18-20-alpine-3-8, build-v1-18-20-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-17-17-alpine-3-8, build-v1-17-17-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-16-15-alpine-3-8, build-v1-16-15-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-15-12-alpine-3-8, build-v1-15-12-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-14-10-alpine-3-8, build-v1-14-10-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8]
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 2eb5365

Please sign in to comment.