Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions .github/workflows/manual-publish-rotom-ng.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: manual-publish-rotom-ng

# Pushes a branch-tagged image for whichever ref this is dispatched on. It runs
# Pushes branch-tagged images for whichever ref this is dispatched on. It runs
# the same test + lint gate as the push workflow, so this cannot ship an image
# that would have failed CI.
on:
Expand All @@ -15,13 +15,19 @@ jobs:

build:
needs: [checks]
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.platform.os }}
permissions:
contents: read
packages: write
strategy:
matrix:
include:
# Both images come from the root Dockerfile, one target apiece, so
# they are matrixed rather than duplicated into a second job. The name
# doubles as the build target and the GHCR repo. 2 x 2 jobs.
image: [rotom-ng, rotom-ng-ui]
# os and arch travel together, so they are one matrix entry rather than
# two dimensions that would cross-product into mismatched pairs.
platform:
- os: ubuntu-latest
arch: linux/amd64
- os: ubuntu-24.04-arm
Expand All @@ -31,11 +37,11 @@ jobs:
uses: actions/checkout@v6
- name: Prepare
run: |
platform=${{ matrix.arch }}
platform=${{ matrix.platform.arch }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: downcase GHCR_REPO
run: |
echo "GHCR_REPO=${{ env.REGISTRY }}/${GITHUB_REPOSITORY,,}/rotom-ng" >>${GITHUB_ENV}
echo "GHCR_REPO=${{ env.REGISTRY }}/${GITHUB_REPOSITORY,,}/${{ matrix.image }}" >>${GITHUB_ENV}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
Expand All @@ -54,8 +60,9 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
file: apps/rotom-ng/Dockerfile
platforms: ${{ matrix.arch }}
file: Dockerfile
target: ${{ matrix.image }}
platforms: ${{ matrix.platform.arch }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,"name=${{ env.GHCR_REPO }}",push-by-digest=true,name-canonical=true,push=true
- name: Export digest
Expand All @@ -66,7 +73,10 @@ jobs:
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
# Namespaced by image: the merge job below collects one image's
# digests at a time, and an unqualified name would mix them and
# produce a manifest listing the wrong architectures.
name: digests-${{ matrix.image }}-${{ env.PLATFORM_PAIR }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1
Expand All @@ -77,14 +87,17 @@ jobs:
permissions:
contents: read
packages: write
strategy:
matrix:
image: [rotom-ng, rotom-ng-ui]
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Download digests
uses: actions/download-artifact@v4
with:
path: ${{ runner.temp }}/digests
pattern: digests-*
pattern: digests-${{ matrix.image }}-*
merge-multiple: true
- name: Log in to the Container registry
uses: docker/login-action@v3
Expand All @@ -96,7 +109,7 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: downcase GHCR_REPO
run: |
echo "GHCR_REPO=${{ env.REGISTRY }}/${GITHUB_REPOSITORY,,}/rotom-ng" >>${GITHUB_ENV}
echo "GHCR_REPO=${{ env.REGISTRY }}/${GITHUB_REPOSITORY,,}/${{ matrix.image }}" >>${GITHUB_ENV}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
Expand Down
31 changes: 22 additions & 9 deletions .github/workflows/publish-rotom-ng.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@ jobs:

build:
needs: [checks]
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.platform.os }}
permissions:
contents: read
packages: write
strategy:
matrix:
include:
# Both images come from the root Dockerfile, one target apiece, so
# they are matrixed rather than duplicated into a second job. The name
# doubles as the build target and the GHCR repo. 2 x 2 jobs.
image: [rotom-ng, rotom-ng-ui]
# os and arch travel together, so they are one matrix entry rather than
# two dimensions that would cross-product into mismatched pairs.
platform:
- os: ubuntu-latest
arch: linux/amd64
- os: ubuntu-24.04-arm
Expand All @@ -33,11 +39,11 @@ jobs:
uses: actions/checkout@v6
- name: Prepare
run: |
platform=${{ matrix.arch }}
platform=${{ matrix.platform.arch }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: downcase GHCR_REPO
run: |
echo "GHCR_REPO=${{ env.REGISTRY }}/${GITHUB_REPOSITORY,,}/rotom-ng" >>${GITHUB_ENV}
echo "GHCR_REPO=${{ env.REGISTRY }}/${GITHUB_REPOSITORY,,}/${{ matrix.image }}" >>${GITHUB_ENV}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
Expand All @@ -56,8 +62,9 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
file: apps/rotom-ng/Dockerfile
platforms: ${{ matrix.arch }}
file: Dockerfile
target: ${{ matrix.image }}
platforms: ${{ matrix.platform.arch }}
labels: ${{ steps.meta.outputs.labels }}
outputs: ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/testing') && format('type=image,"name={0}",push-by-digest=true,name-canonical=true,push=true', env.GHCR_REPO) || 'type=docker' }}
- name: Export digest
Expand All @@ -70,7 +77,10 @@ jobs:
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/testing'
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
# Namespaced by image: the merge job below collects one image's
# digests at a time, and an unqualified name would mix them and
# produce a manifest listing the wrong architectures.
name: digests-${{ matrix.image }}-${{ env.PLATFORM_PAIR }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1
Expand All @@ -82,14 +92,17 @@ jobs:
permissions:
contents: read
packages: write
strategy:
matrix:
image: [rotom-ng, rotom-ng-ui]
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Download digests
uses: actions/download-artifact@v4
with:
path: ${{ runner.temp }}/digests
pattern: digests-*
pattern: digests-${{ matrix.image }}-*
merge-multiple: true
- name: Log in to the Container registry
uses: docker/login-action@v3
Expand All @@ -101,7 +114,7 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: downcase GHCR_REPO
run: |
echo "GHCR_REPO=${{ env.REGISTRY }}/${GITHUB_REPOSITORY,,}/rotom-ng" >>${GITHUB_ENV}
echo "GHCR_REPO=${{ env.REGISTRY }}/${GITHUB_REPOSITORY,,}/${{ matrix.image }}" >>${GITHUB_ENV}
# Branch tag only. Version tags (and releases) are published by release.yml,
# which is manual.
- name: Docker meta
Expand Down
59 changes: 43 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,20 @@ jobs:

build:
needs: [prepare]
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.platform.os }}
permissions:
contents: read
packages: write
strategy:
matrix:
include:
# Both images come from the root Dockerfile, one target apiece, at the
# same version, so they are matrixed rather than duplicated into a
# second job. The name doubles as the build target, the GHCR repo, and
# the binary inside the image. 2 x 2 jobs.
image: [rotom-ng, rotom-ng-ui]
# os and arch travel together, so they are one matrix entry rather than
# two dimensions that would cross-product into mismatched pairs.
platform:
- os: ubuntu-latest
arch: linux/amd64
pair: linux-amd64
Expand All @@ -104,7 +111,7 @@ jobs:
uses: actions/checkout@v6
- name: downcase GHCR_REPO
run: |
echo "GHCR_REPO=${{ env.REGISTRY }}/${GITHUB_REPOSITORY,,}/rotom-ng" >>${GITHUB_ENV}
echo "GHCR_REPO=${{ env.REGISTRY }}/${GITHUB_REPOSITORY,,}/${{ matrix.image }}" >>${GITHUB_ENV}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
Expand All @@ -125,8 +132,9 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
file: apps/rotom-ng/Dockerfile
platforms: ${{ matrix.arch }}
file: Dockerfile
target: ${{ matrix.image }}
platforms: ${{ matrix.platform.arch }}
labels: ${{ steps.meta.outputs.labels }}
# Attestations can carry build-path metadata; keep the image to just the binary.
provenance: false
Expand All @@ -140,24 +148,30 @@ jobs:
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ matrix.pair }}
# Namespaced by image: merge-image collects one image's digests at a
# time, and an unqualified name would mix them into a manifest
# listing the wrong architectures.
name: digests-${{ matrix.image }}-${{ matrix.platform.pair }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1
- name: Extract binary from the image
uses: docker/build-push-action@v6
with:
context: .
file: apps/rotom-ng/Dockerfile
platforms: ${{ matrix.arch }}
file: Dockerfile
target: ${{ matrix.image }}
platforms: ${{ matrix.platform.arch }}
provenance: false
sbom: false
outputs: type=local,dest=${{ runner.temp }}/image-out
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: rotom-ng-binary-${{ matrix.pair }}
path: ${{ runner.temp }}/image-out/rotom-ng/rotom-ng
# Each target's WORKDIR is named after its binary, so the path
# inside the exported image is <name>/<name>.
name: binary-${{ matrix.image }}-${{ matrix.platform.pair }}
path: ${{ runner.temp }}/image-out/${{ matrix.image }}/${{ matrix.image }}
if-no-files-found: error
retention-days: 1

Expand All @@ -167,12 +181,15 @@ jobs:
permissions:
contents: read
packages: write
strategy:
matrix:
image: [rotom-ng, rotom-ng-ui]
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: ${{ runner.temp }}/digests
pattern: digests-*
pattern: digests-${{ matrix.image }}-*
merge-multiple: true
- name: Log in to the Container registry
uses: docker/login-action@v3
Expand All @@ -184,7 +201,7 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: downcase GHCR_REPO
run: |
echo "GHCR_REPO=${{ env.REGISTRY }}/${GITHUB_REPOSITORY,,}/rotom-ng" >>${GITHUB_ENV}
echo "GHCR_REPO=${{ env.REGISTRY }}/${GITHUB_REPOSITORY,,}/${{ matrix.image }}" >>${GITHUB_ENV}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
Expand Down Expand Up @@ -218,7 +235,7 @@ jobs:
uses: actions/download-artifact@v4
with:
path: ${{ runner.temp }}/binaries
pattern: rotom-ng-binary-*
pattern: binary-*
- name: Build tarballs
run: |
set -eu
Expand All @@ -227,7 +244,12 @@ jobs:
dir="${{ runner.temp }}/stage/rotom-ng-v${VERSION}"
rm -rf "${{ runner.temp }}/stage"
mkdir -p "$dir"
install -m 755 "${{ runner.temp }}/binaries/rotom-ng-binary-${pair}/rotom-ng" "$dir/rotom-ng"
# Both binaries ship in the one tarball: they are the same version
# built from the same tree, and configs/ already carries an example
# for each, so splitting them would duplicate everything else.
for bin in rotom-ng rotom-ng-ui; do
install -m 755 "${{ runner.temp }}/binaries/binary-${bin}-${pair}/${bin}" "$dir/${bin}"
done
# A fresh checkout contains tracked files only, so this cannot pick up
# local work-in-progress. logs/ is created empty rather than copied so
# its .KEEP placeholder does not ship.
Expand Down Expand Up @@ -261,13 +283,18 @@ jobs:
if [ '${{ needs.prepare.outputs.prerelease }}' = 'true' ]; then
prerelease_flag='--prerelease'
fi
image="${{ env.REGISTRY }}/${GITHUB_REPOSITORY,,}/rotom-ng:v${VERSION}"
repo="${{ env.REGISTRY }}/${GITHUB_REPOSITORY,,}"
# Built with printf so no leading indentation leaks in and turns the
# notes into a markdown code block.
notes=$(printf '%s\n' \
"RotomNG ${VERSION}" \
"" \
"Container image: \`${image}\`")
"Container images:" \
"" \
"- \`${repo}/rotom-ng:v${VERSION}\`" \
"- \`${repo}/rotom-ng-ui:v${VERSION}\` -- multi-instance admin UI, optional" \
"" \
"The tarballs carry both binaries.")

# --target takes the exact commit this ran on, so the release does not
# drift if the branch moves on afterwards.
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
/tmp
/out-tsc
/rotom-ng
/rotom-ng-ui
/apps/rotom-ng/rotom-ng
/apps/rotom-ng-ui-server/rotom-ng-ui

# dependencies
node_modules
Expand Down
Loading
Loading