Skip to content

Commit

Permalink
Merge pull request #21 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 731ba40 + b15bf26 commit 7f8c788
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-3-4-jq-sops-ssh-alpine-3-17:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -1943,3 +1964,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-3-4-jq-sops-ssh-alpine-3-17, build-v1-3-4-jq-libvirt-sops-ssh-alpine-3-17, build-v1-2-0-jq-sops-ssh-alpine-3-16, build-v1-0-11-jq-sops-ssh-alpine-3-15, build-v0-14-9-jq-sops-ssh-alpine-3-14, build-v0-14-4-jq-sops-ssh-alpine-3-13, build-v0-12-25-jq-sops-ssh-alpine-3-12, build-v0-12-17-jq-sops-ssh-alpine-3-11, build-v0-12-6-jq-sops-ssh-alpine-3-10, build-v0-11-8-jq-sops-ssh-alpine-3-9, build-v0-11-7-jq-sops-ssh-alpine-3-8, build-v0-11-0-jq-sops-ssh-alpine-3-7, build-v0-9-5-jq-sops-ssh-alpine-3-6, build-v0-8-1-jq-sops-ssh-alpine-3-5]
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 7f8c788

Please sign in to comment.