Files
boutmoun 0ef65a6149
Build and publish Boutmoun Docker image / publish (push) Failing after 13s
Use Gitea runner image with Node and Docker
2026-11-14 13:05:52 +03:00

80 lines
3.0 KiB
YAML

name: Build and publish Boutmoun Docker image
on:
push:
branches:
- main
workflow_dispatch:
jobs:
publish:
runs-on: ghaymah2
container:
image: docker.gitea.com/runner-images:ubuntu-latest
steps:
# This global runner currently has no `node` on PATH, which checkout requires.
# Install a pinned Node.js runtime before invoking JavaScript-based actions.
- name: Prepare Node.js for checkout
shell: bash
run: |
set -eu
if command -v node >/dev/null 2>&1; then
node --version
exit 0
fi
if ! command -v curl >/dev/null 2>&1 || ! command -v tar >/dev/null 2>&1 || ! command -v sha256sum >/dev/null 2>&1; then
echo 'Runner needs curl, tar and sha256sum, or preinstalled Node.js. Ask the GitPasha runner administrator.' >&2
exit 1
fi
VERSION='24.22.3'
ARCH='linux-x64'
if ldd --version 2>&1 | grep -qi musl; then ARCH='linux-x64-musl'; fi
ARCHIVE="node-v${VERSION}-${ARCH}.tar.gz"
BASE_URL="https://nodejs.org/dist/v${VERSION}"
WORK_DIR="$(mktemp -d /tmp/boutmoun-node.XXXXXX)"
mkdir -p "${WORK_DIR}/node"
curl --fail --location --silent --show-error "${BASE_URL}/${ARCHIVE}" -o "${WORK_DIR}/${ARCHIVE}"
curl --fail --location --silent --show-error "${BASE_URL}/SHASUMS256.txt" -o "${WORK_DIR}/SHASUMS256.txt"
(cd "${WORK_DIR}" && grep -F " ${ARCHIVE}" SHASUMS256.txt | sha256sum -c -)
tar -xzf "${WORK_DIR}/${ARCHIVE}" -C "${WORK_DIR}/node" --strip-components=1
echo "${WORK_DIR}/node/bin" >> "${GITHUB_PATH}"
"${WORK_DIR}/node/bin/node" --version
- name: Check out repository
uses: actions/checkout@v4
- name: Verify Docker is available
run: docker info
- name: Log in to GitPasha Container Registry
env:
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
run: |
set -eu
if [ -z "$REGISTRY_USERNAME" ] || [ -z "$REGISTRY_TOKEN" ]; then
echo 'Configure REGISTRY_USERNAME and REGISTRY_TOKEN in repository Actions secrets.' >&2
exit 1
fi
printf '%s' "$REGISTRY_TOKEN" | docker login app.gitpasha.com --username "$REGISTRY_USERNAME" --password-stdin
- name: Build and push Linux/amd64 image
env:
IMAGE: app.gitpasha.com/boutmoun/gracesalmoun
COMMIT_SHA: ${{ gitea.sha }}
run: |
set -eu
SHA_TAG="sha-${COMMIT_SHA}"
docker build --pull --platform linux/amd64 \
-t "${IMAGE}:${SHA_TAG}" \
-t "${IMAGE}:latest" \
.
docker push "${IMAGE}:${SHA_TAG}"
docker push "${IMAGE}:latest"
echo "Published ${IMAGE}:${SHA_TAG}"
echo "Published ${IMAGE}:latest"
- name: Log out of registry
if: always()
run: docker logout app.gitpasha.com || true