CI: make building container image optional; tag it with the git version
All checks were successful
/ build (push) Successful in 20s
All checks were successful
/ build (push) Successful in 20s
This commit is contained in:
parent
09f487ea2b
commit
9a0406d9e8
1 changed files with 18 additions and 2 deletions
|
@ -1,5 +1,12 @@
|
|||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
build:
|
||||
description: "Build container"
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -24,20 +31,28 @@ jobs:
|
|||
- name: Build package (transpile ts => js)
|
||||
run: ng build
|
||||
|
||||
- name: Get the version from git
|
||||
id: version
|
||||
if: ${{ inputs.build }}
|
||||
run: echo "version=$(git describe --dirty --tags)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build container
|
||||
if: ${{ inputs.build }}
|
||||
uses: actions/buildah-build@v1
|
||||
with:
|
||||
image: treetrail-frontend
|
||||
#tags: foo # v1 ${{ github.sha }}
|
||||
tags: ${{ steps.version.outputs.version }}
|
||||
containerfiles: |
|
||||
./Containerfile
|
||||
|
||||
- name: Workaround for bug of podman-login
|
||||
if: ${{ inputs.build }}
|
||||
run: |
|
||||
mkdir -p $HOME/.docker
|
||||
echo "{ \"auths\": {} }" > $HOME/.docker/config.json
|
||||
|
||||
- name: Log in to container registry (with another workaround)
|
||||
if: ${{ inputs.build }}
|
||||
uses: actions/podman-login@v1
|
||||
with:
|
||||
registry: ${{ vars.REGISTRY }}
|
||||
|
@ -46,7 +61,8 @@ jobs:
|
|||
auth_file_path: /tmp/auth.json
|
||||
|
||||
- uses: actions/push-to-registry@v2
|
||||
if: ${{ inputs.build }}
|
||||
with:
|
||||
registry: "docker://${{ vars.REGISTRY }}"
|
||||
image: treetrail-frontend
|
||||
tags: latest
|
||||
tags: ${{ steps.version.outputs.version }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue