ci: embed build & push script in workflow (#154)
This is to make it possible to build previous versions via the workflow_dispatch event.
This commit is contained in:
parent
10b93243bc
commit
7844cb57aa
30
.github/workflows/docker-image-push.yml
vendored
30
.github/workflows/docker-image-push.yml
vendored
|
@ -58,4 +58,32 @@ jobs:
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
env:
|
env:
|
||||||
PLATFORMS: linux/amd64,linux/arm64/v8,linux/arm/v7
|
PLATFORMS: linux/amd64,linux/arm64/v8,linux/arm/v7
|
||||||
run: ./scripts/build-and-push.sh
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
VERSION="$(git describe --exact-match --tags HEAD)"
|
||||||
|
TAG="$VERSION"
|
||||||
|
MAJOR_TAG="$(sed -nre 's/^([0-9]+).*/\1/p' <<< "$VERSION")"
|
||||||
|
DOCKERHUB_IMAGE="thelounge/thelounge"
|
||||||
|
GITHUB_IMAGE="ghcr.io/thelounge/thelounge"
|
||||||
|
TAGS=(
|
||||||
|
"--tag" "${DOCKERHUB_IMAGE}:${TAG}"
|
||||||
|
"--tag" "${GITHUB_IMAGE}:${TAG}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# If not a pre-release push :latest & MAJOR_TAG
|
||||||
|
if grep -qE "^[0-9]*\.[0-9]*\.[0-9]*$" <<< "${VERSION}"; then
|
||||||
|
TAGS+=(
|
||||||
|
"--tag" "${DOCKERHUB_IMAGE}:latest"
|
||||||
|
"--tag" "${DOCKERHUB_IMAGE}:${MAJOR_TAG}"
|
||||||
|
"--tag" "${GITHUB_IMAGE}:latest"
|
||||||
|
"--tag" "${GITHUB_IMAGE}:${MAJOR_TAG}"
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker buildx build \
|
||||||
|
--push \
|
||||||
|
--platform "${PLATFORMS}" \
|
||||||
|
"${TAGS[@]}" \
|
||||||
|
--file Dockerfile \
|
||||||
|
.
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
# Script executed by GitHub actions.
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
VERSION="$(git describe --exact-match --tags HEAD)"
|
|
||||||
TAG="$VERSION"
|
|
||||||
MAJOR_TAG="$(sed -nre 's/^([0-9]+).*/\1/p' <<< "$VERSION")"
|
|
||||||
DOCKERHUB_IMAGE="thelounge/thelounge"
|
|
||||||
GITHUB_IMAGE="ghcr.io/thelounge/thelounge"
|
|
||||||
TAGS=(
|
|
||||||
"--tag" "${DOCKERHUB_IMAGE}:${TAG}"
|
|
||||||
"--tag" "${GITHUB_IMAGE}:${TAG}"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# If not a pre-release push :latest & MAJOR_TAG
|
|
||||||
if grep -qE "^[0-9]*\.[0-9]*\.[0-9]*$" <<< "${VERSION}"; then
|
|
||||||
TAGS+=(
|
|
||||||
"--tag" "${DOCKERHUB_IMAGE}:latest"
|
|
||||||
"--tag" "${DOCKERHUB_IMAGE}:${MAJOR_TAG}"
|
|
||||||
"--tag" "${GITHUB_IMAGE}:latest"
|
|
||||||
"--tag" "${GITHUB_IMAGE}:${MAJOR_TAG}"
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
|
|
||||||
docker buildx build \
|
|
||||||
--push \
|
|
||||||
--platform "${PLATFORMS}" \
|
|
||||||
"${TAGS[@]}" \
|
|
||||||
--file Dockerfile \
|
|
||||||
.
|
|
Loading…
Reference in a new issue