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
27 changes: 19 additions & 8 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- main
- "v*.*.x"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -141,10 +143,10 @@ jobs:
labels: |
org.opencontainers.image.revision=${{ github.sha }}
tags: |
${{ steps.registry.outputs.image_registry }}/${{ matrix.image }}:main-${{ matrix.arch }}
${{ steps.registry.outputs.image_registry }}/${{ matrix.image }}:${{ github.ref_name }}-${{ matrix.arch }}
${{ steps.registry.outputs.image_registry }}/${{ matrix.image }}:${{ github.sha }}-${{ matrix.arch }}
cache-from: type=gha,scope=refs/heads/main-${{ matrix.image }}-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=refs/heads/main-${{ matrix.image }}-${{ matrix.arch }}
cache-from: type=gha,scope=${{ github.ref }}-${{ matrix.image }}-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=${{ github.ref }}-${{ matrix.image }}-${{ matrix.arch }}

merge-manifests:
name: Create Multi-Arch Manifests
Expand Down Expand Up @@ -193,7 +195,7 @@ jobs:
run: |
set -euo pipefail
echo "version=${{ needs.resolved-version-tags.outputs.amber_cli_version }}" >> "$GITHUB_OUTPUT"
- name: Publish base multi-arch tags (main + sha)
- name: Publish base multi-arch tags (branch + sha)
shell: bash
run: |
set -euo pipefail
Expand All @@ -202,9 +204,9 @@ jobs:
[ -z "$image" ] && continue
docker buildx imagetools create \
--annotation "index:org.opencontainers.image.revision=${GITHUB_SHA}" \
-t "${image}:main" \
"${image}:main-amd64" \
"${image}:main-arm64"
-t "${image}:${GITHUB_REF_NAME}" \
"${image}:${GITHUB_REF_NAME}-amd64" \
"${image}:${GITHUB_REF_NAME}-arm64"
docker buildx imagetools create \
--annotation "index:org.opencontainers.image.revision=${GITHUB_SHA}" \
-t "${image}:${GITHUB_SHA}" \
Expand Down Expand Up @@ -574,11 +576,20 @@ jobs:
run: |
mkdir -p .tmp
node npm/release.mjs spec > .tmp/npm-release-spec.json

dist_tag="latest"
if [ "$GITHUB_REF_NAME" != "main" ]; then
version_series="${GITHUB_REF_NAME#v}"
version_series="${version_series%.x}"
dist_tag="series-${version_series}"
fi

node npm/release.mjs publish-release \
--spec .tmp/npm-release-spec.json \
--artifact-root .tmp/npm-binary-artifacts \
--out-dir .tmp/npm-packages \
--version-floor "${{ needs.resolved-version-tags.outputs.amber_cli_version }}"
--version-floor "${{ needs.resolved-version-tags.outputs.amber_cli_version }}" \
--dist-tag "$dist_tag"

cli-artifacts:
name: Build amber-cli artifacts (${{ matrix.platform }})
Expand Down
10 changes: 6 additions & 4 deletions npm/release.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -577,14 +577,14 @@ async function resolveRuntimePackageVersions({ spec, packageRoot, versionFloors
}
}

function npmPublish(dir) {
runCommand("npm", ["publish", "--access", "public", "--registry", NPM_REGISTRY], {
function npmPublish(dir, distTag) {
runCommand("npm", ["publish", "--access", "public", "--registry", NPM_REGISTRY, "--tag", distTag], {
cwd: dir,
env: process.env,
});
}

async function publishPackages({ spec, packageRoot }) {
async function publishPackages({ spec, packageRoot, distTag }) {
const packageDirs = spec.runtime_packages.flatMap((runtimePackage) =>
runtimePackagePublishDirs(runtimePackage, packageRoot),
);
Expand All @@ -603,7 +603,7 @@ async function publishPackages({ spec, packageRoot }) {
fail(`${packageJson.name}@${packageJson.version} already exists with different contents`);
}

npmPublish(dir);
npmPublish(dir, distTag);
}
}

Expand Down Expand Up @@ -668,6 +668,7 @@ async function publishRelease(args) {
const spec = readSpec(args);
const outDir = requireFlag(args, "--out-dir");
const versionFloor = requireFlag(args, "--version-floor");
const distTag = requireFlag(args, "--dist-tag");

stagePackages({
spec,
Expand All @@ -685,6 +686,7 @@ async function publishRelease(args) {
await publishPackages({
spec,
packageRoot: outDir,
distTag,
});
}

Expand Down
Loading