Skip to content

Upgrade minver@5.0.0 #57

Upgrade minver@5.0.0

Upgrade minver@5.0.0 #57

name: Build minver-cli image
on:
push:
branches: [minver, "minver/dev*"]
tags: ["minver-*.*.*", "minver-*.*"]
pull_request:
branches: [minver]
jobs:
docker:
strategy:
fail-fast: false
matrix:
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: Check Tag Ref
shell: pwsh
run: |
$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
}
}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ 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
type=sha,enable=true,priority=500,prefix=sha-,suffix=,format=short
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
context: ./minver
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 }}