mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-04 20:13:03 +00:00
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
87 lines
2.3 KiB
YAML
87 lines
2.3 KiB
YAML
name: Build HugoBlox devcontainer image
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- ".devcontainer/base.Dockerfile"
|
|
- ".github/workflows/devcontainer-image.yml"
|
|
workflow_dispatch:
|
|
inputs:
|
|
hugo_versions:
|
|
description: "Comma-separated Hugo versions to build (e.g. 0.152.2,0.154.0)"
|
|
required: false
|
|
|
|
env:
|
|
IMAGE_NAME: ghcr.io/hugoblox/hugo-blox-dev
|
|
DEFAULT_HUGO_VERSION: 0.152.2
|
|
NODE_VERSION: 20
|
|
PNPM_VERSION: 10.14.0
|
|
|
|
jobs:
|
|
prepare-matrix:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
versions: ${{ steps.versions.outputs.matrix }}
|
|
steps:
|
|
- name: Select Hugo versions
|
|
id: versions
|
|
env:
|
|
VERSIONS: ${{ github.event.inputs.hugo_versions || env.DEFAULT_HUGO_VERSION }}
|
|
run: |
|
|
MATRIX=$(python - <<'PY'
|
|
import os, json
|
|
versions = [v.strip() for v in os.environ["VERSIONS"].split(",") if v.strip()]
|
|
print(json.dumps(versions))
|
|
PY
|
|
)
|
|
echo "matrix=${MATRIX}" >> "$GITHUB_OUTPUT"
|
|
|
|
build-and-push:
|
|
needs: prepare-matrix
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
hugo: ${{ fromJson(needs.prepare-matrix.outputs.versions) }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Compute tags
|
|
id: tags
|
|
env:
|
|
HUGO_VERSION: ${{ matrix.hugo }}
|
|
run: |
|
|
TAGS="${IMAGE_NAME}:hugo${HUGO_VERSION}"
|
|
if [ "${HUGO_VERSION}" = "${DEFAULT_HUGO_VERSION}" ]; then
|
|
TAGS="${TAGS}\n${IMAGE_NAME}:latest"
|
|
fi
|
|
{
|
|
echo "list<<EOF"
|
|
printf "%b\n" "$TAGS"
|
|
echo "EOF"
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Build and push image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: .devcontainer/base.Dockerfile
|
|
push: true
|
|
build-args: |
|
|
HUGO_VERSION=${{ matrix.hugo }}
|
|
NODE_VERSION=${{ env.NODE_VERSION }}
|
|
PNPM_VERSION=${{ env.PNPM_VERSION }}
|
|
tags: ${{ steps.tags.outputs.list }}
|