Skip to content

Commit

Permalink
Fix multi images with conditions (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
thohng authored Jul 15, 2023
1 parent cea9702 commit 6dafae2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/docker-minver-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,30 @@ jobs:
runs-on: [ubuntu-latest]
name: build-${{ matrix.runs-on }}
runs-on: ${{ matrix.runs-on }}
env:
IS_SEMVER_TAG: ${{ false }}
IS_TAG: ${{ null }}
steps:
- uses: actions/checkout@v3

- name: Docker Repos Selection
id: repos
- name: Check Tag Ref
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'
$isTag='${{ startsWith(github.ref, 'refs/tags/') }}'
Write-Output "IS_TAG=$isTag" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
if ($true -eq $isTag) {
if ($Env:GITHUB_REF_NAME -match '^minver-(\d+\.\d+(\.\d+)?(-.+)?)$') {
Write-Output "IS_SEMVER_TAG=true" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
}
}
Write-Output "content=$repos" >> $env:GITHUB_OUTPUT
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ steps.repos.outputs.content }}
${{ secrets.DOCKER_HUB_MINVER_CLI_REPOS }}
name=teslaconsulting/minver-cli,enable=${{ env.IS_SEMVER_TAG == 'true' }}
tags: |
type=match,enable=true,priority=900,prefix=,suffix=,pattern=^minver-(\d+\.\d+(\.\d+)?(-.+)?)$,group=1
type=ref,enable=true,priority=600,event=branch
Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/docker-teamcityagent-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,30 @@ jobs:
runs-on: [ubuntu-latest]
name: build-${{ matrix.runs-on }}
runs-on: ${{ matrix.runs-on }}
env:
IS_SEMVER_TAG: ${{ false }}
IS_TAG: ${{ null }}
steps:
- uses: actions/checkout@v3

- name: Docker Repos Selection
id: repos
- name: Check Tag Ref
shell: pwsh
run: |
$repos='${{ secrets.DOCKER_HUB_REPOS }}'.Trim()
if ($Env:GITHUB_REF_NAME -match '^(\d+\.\d+(\.\d+)?(-.+)?)$') {
$repos+='%0A'
$repos+='teslaconsulting/teamcity-agent'
$isTag='${{ startsWith(github.ref, 'refs/tags/') }}'
Write-Output "IS_TAG=$isTag" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
if ($true -eq $isTag) {
if ($Env:GITHUB_REF_NAME -match '^(\d+\.\d+(\.\d+)?(-.+)?)$') {
Write-Output "IS_SEMVER_TAG=true" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
}
}
Write-Output "content=$repos" >> $env:GITHUB_OUTPUT
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ steps.repos.outputs.content }}
${{ secrets.DOCKER_HUB_REPOS }}
name=teslaconsulting/teamcity-agent,enable=${{ env.IS_SEMVER_TAG == 'true' }}
tags: |
type=match,enable=true,priority=900,prefix=,suffix=,pattern=^(\d+\.\d+(\.\d+)?(-.+)?)$,group=1
type=match,enable=true,priority=890,prefix=,suffix=,pattern=^(\d+\.\d+(\.\d+)?)(-.+)?$,group=1
Expand Down

0 comments on commit 6dafae2

Please sign in to comment.