CI: build container when the version is a clean git tag 3

This commit is contained in:
phil 2024-11-03 16:19:52 +01:00
parent 7f037dcbf8
commit 4f8c764fbe

View file

@ -16,6 +16,17 @@ jobs:
with:
fetch-depth: 0
- name: Get the version from git
id: version
run: echo "version=$(git describe --dirty --tags)" >> $GITHUB_OUTPUT
- name: Check if the container should be built
id: builder
run: echo "run=toJSON(${{ inputs.build || !contains(steps.version.output.version, '-')) }}" >> $GITHUB_OUTPUT
- name: Check
run: echo "Build? fromJSON(${{ steps.builder.output.run }})"
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
@ -37,19 +48,8 @@ jobs:
# if: ${{ inputs.build }}
# run: git pull --unshallow
- name: Get the version from git
id: version
run: echo "version=$(git describe --dirty --tags)" >> $GITHUB_OUTPUT
- name: Check if the container should be built
id: builder
run: echo "run=${{ inputs.build || !contains(steps.version.output.version, '-') }}" >> $GITHUB_OUTPUT
- name: Check
run: echo "Build? ${{ steps.builder.output.run }}"
- name: Build container
if: ${{ steps.builder.output.run }}
if: fromJSON(steps.builder.output.run)
uses: actions/buildah-build@v1
with:
image: treetrail-frontend
@ -60,13 +60,13 @@ jobs:
./Containerfile
- name: Workaround for bug of podman-login
if: ${{ steps.builder.output.run }}
if: fromJSON(steps.builder.output.run)
run: |
mkdir -p $HOME/.docker
echo "{ \"auths\": {} }" > $HOME/.docker/config.json
- name: Log in to container registry (with another workaround)
if: ${{ steps.builder.output.run }}
if: fromJSON(steps.builder.output.run)
uses: actions/podman-login@v1
with:
registry: ${{ vars.REGISTRY }}
@ -75,7 +75,7 @@ jobs:
auth_file_path: /tmp/auth.json
- uses: actions/push-to-registry@v2
if: ${{ steps.builder.output.run }}
if: fromJSON(steps.builder.output.run)
with:
registry: "docker://${{ vars.REGISTRY }}"
image: treetrail-frontend