From 1b1e95875df43715b740b6000590077063c4b8e5 Mon Sep 17 00:00:00 2001 From: Leonard Jonathan Oh Date: Fri, 27 Jan 2023 11:03:22 +0000 Subject: [PATCH] Enhancement (ci): Add `test-nogitdiff` and `update-dockerhub-description` jobs --- .github/workflows/ci-master-pr.yml | 35 ++++++++++++ .../.github/workflows/ci-master-pr.yml.ps1 | 55 ++++++++++++++----- 2 files changed, 75 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci-master-pr.yml b/.github/workflows/ci-master-pr.yml index e31f4b3..9c55fd5 100644 --- a/.github/workflows/ci-master-pr.yml +++ b/.github/workflows/ci-master-pr.yml @@ -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 @@ -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 }} diff --git a/generate/templates/.github/workflows/ci-master-pr.yml.ps1 b/generate/templates/.github/workflows/ci-master-pr.yml.ps1 index 6d6cf19..36ab7f1 100644 --- a/generate/templates/.github/workflows/ci-master-pr.yml.ps1 +++ b/generate/templates/.github/workflows/ci-master-pr.yml.ps1 @@ -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('.', '-') )" } @@ -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: @@ -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: @@ -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 }} + +"@