Skip to content

Commit

Permalink
Push public repos on tag only
Browse files Browse the repository at this point in the history
  • Loading branch information
thohng committed Sep 28, 2022
1 parent 1bdf8f9 commit 5767e1b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 11 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/docker-minver-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,40 @@ jobs:
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v2

- name: Docker Repos Selection
id: repos
shell: pwsh
run: |
$repos='${{ secrets.DOCKER_HUB_MINVER_CLI_REPOS }}'.Trim()
if ($Env:GITHUB_REF_NAME -match '^minver-(\d+\.\d+(\.\d+)?(-.+)?)$') {
$repos+='%0A'
$repos+='teslaconsulting/minver-cli'
}
Write-Output "::set-output name=content::$repos"
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
${{ secrets.DOCKER_HUB_MINVER_CLI_REPOS }}
teslaconsulting/minver-cli
${{ steps.repos.outputs.content }}
tags: |
type=ref,event=branch,priority=600
type=sha,enable=true,priority=500,prefix=sha-,suffix=,format=short
type=match,enable=true,priority=900,prefix=,suffix=,pattern=^minver-(\d+\.\d+(\.\d+)?(-.+)?)$,group=1
type=ref,enable=true,priority=600,event=branch
type=sha,enable=true,priority=500,prefix=sha-,suffix=,format=short
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
Expand All @@ -45,5 +59,6 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
24 changes: 17 additions & 7 deletions .github/workflows/docker-teamcityagent-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,30 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Docker Repos Selection
id: repos
shell: pwsh
run: |
$repos='${{ secrets.DOCKER_HUB_REPOS }}'.Trim()
if ($Env:GITHUB_REF_NAME -match '^(\d+\.\d+(\.\d+)?(-.+)?)$') {
$repos+='%0A'
$repos+='teslaconsulting/teamcity-agent'
}
Write-Output "::set-output name=content::$repos"
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
${{ secrets.DOCKER_HUB_REPOS }}
teslaconsulting/teamcity-agent
${{ steps.repos.outputs.content }}
tags: |
type=ref,event=branch,priority=600
type=sha,enable=true,priority=500,prefix=sha-,suffix=,format=short
type=match,enable=true,priority=900,prefix=,suffix=,pattern=^(\d+\.\d+(\.\d+)?(-.+)?)$,group=1
type=match,enable=true,priority=880,prefix=,suffix=,pattern=^(\d+\.\d+(\.\d+))?(-.+)?$,group=1
type=match,enable=true,priority=870,prefix=,suffix=,pattern=^(\d+\.\d+)(\.\d+)?(-.+)?$,group=1
type=match,enable=true,priority=860,prefix=,suffix=,pattern=^(\d+)\.\d+(\.\d+)?(-.+)?$,group=1
type=match,enable=true,priority=890,prefix=,suffix=,pattern=^(\d+\.\d+(\.\d+)?)(-.+)?$,group=1
type=match,enable=true,priority=880,prefix=,suffix=,pattern=^(\d+\.\d+)(\.\d+)?(-.+)?$,group=1
type=match,enable=true,priority=870,prefix=,suffix=,pattern=^(\d+)\.\d+(\.\d+)?(-.+)?$,group=1
type=ref,enable=true,priority=600,event=branch
type=sha,enable=true,priority=500,prefix=sha-,suffix=,format=short
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v1

Expand Down

0 comments on commit 5767e1b

Please sign in to comment.