build image on tag
Signed-off-by: Quan TRAN <account@itscaro.me>
This commit is contained in:
parent
4959c5bdde
commit
d5f37b0e35
|
|
@ -4,14 +4,19 @@ outputs:
|
||||||
sha_short:
|
sha_short:
|
||||||
description: "The short SHA used for image builds"
|
description: "The short SHA used for image builds"
|
||||||
value: ${{ steps.vars.outputs.sha_short }}
|
value: ${{ steps.vars.outputs.sha_short }}
|
||||||
|
tag:
|
||||||
|
description: "The tag if run against a tag, otherwise 'canary'"
|
||||||
|
value: ${{ steps.vars.outputs.tag }}
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: Get Short SHA
|
- name: Get Short SHA & Tag
|
||||||
id: vars
|
id: vars
|
||||||
run: |
|
run: |
|
||||||
echo ::set-output name=sha_short::${GITHUB_SHA::7}
|
echo ::set-output name=sha_short::${GITHUB_SHA::7}
|
||||||
|
TAG=${GITHUB_REF/refs\/tags\//}
|
||||||
|
echo ::set-output name=tag::${TAG:-canary}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-test:
|
build-test:
|
||||||
if: ${{ github.ref != 'refs/heads/main' }}
|
if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
@ -40,7 +40,7 @@ jobs:
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
|
|
||||||
build:
|
build:
|
||||||
if: ${{ github.ref == 'refs/heads/main' }}
|
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
@ -70,7 +70,7 @@ jobs:
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
ghcr.io/${{ github.repository }}:canary
|
ghcr.io/${{ github.repository }}:${{ steps.vars.outputs.tag }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
|
@ -81,6 +81,6 @@ jobs:
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
ghcr.io/${{ github.repository }}-debian-stable-slim:canary
|
ghcr.io/${{ github.repository }}-debian-stable-slim:${{ steps.vars.outputs.tag }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
Loading…
Reference in New Issue