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