Update node version (#1782) #1372
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release npm package and container image | |
on: | |
push: | |
branches: | |
- master | |
- release/* | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
pkg: | |
if: github.repository == 'CycloneDX/cdxgen' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '23.x' | |
registry-url: https://registry.npmjs.org/ | |
- name: Trim CI agent | |
run: | | |
chmod +x contrib/free_disk_space.sh | |
./contrib/free_disk_space.sh | |
- name: Release npm package | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
npm install --global corepack@latest | |
corepack enable | |
corepack pnpm install --config.strict-dep-builds=true | |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN | |
echo "cyclonedx:registry=https://registry.npmjs.org" > ~/.npmrc | |
NPM_CONFIG_PROVENANCE=true corepack pnpm publish --access=public --no-git-checks | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: jsr publish | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
npm install --global corepack@latest | |
corepack enable | |
corepack pnpm install --config.strict-dep-builds=true | |
npx jsr publish --allow-dirty | |
continue-on-error: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
containers: | |
if: github.repository == 'CycloneDX/cdxgen' | |
runs-on: ["self-hosted", "ubuntu", "amd64"] | |
permissions: | |
contents: write | |
packages: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/cyclonedx/cdxgen | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ci/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: nydusify | |
run: | | |
nydusify convert --oci --oci-ref --source ${{ steps.meta.outputs.tags }} --target ${{ steps.meta.outputs.tags }}-nydus --prefetch-dir /opt/cdxgen | |
nydusify check --target ${{ steps.meta.outputs.tags }}-nydus | |
if: github.ref == 'refs/heads/master' | |
continue-on-error: true | |
- name: Attach cdx sbom | |
run: | | |
corepack pnpm install --config.strict-dep-builds=true --package-import-method copy | |
node bin/cdxgen.js -t docker -o cdxgen-oci-image.cdx.json ghcr.io/cyclonedx/cdxgen:latest | |
oras attach --artifact-type sbom/cyclonedx ghcr.io/cyclonedx/cdxgen:latest ./cdxgen-oci-image.cdx.json:application/json | |
oras discover --format tree ghcr.io/cyclonedx/cdxgen:latest | |
continue-on-error: true | |
if: startsWith(github.ref, 'refs/tags/') | |
- name: Attach cdx sbom to release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
cdxgen-oci-image.cdx.json | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
containers-secure: | |
if: github.repository == 'CycloneDX/cdxgen' | |
runs-on: ["self-hosted", "ubuntu", "amd64"] | |
permissions: | |
contents: write | |
packages: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta2 | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/cyclonedx/cdxgen-secure | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ci/Dockerfile-secure | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta2.outputs.tags }} | |
labels: ${{ steps.meta2.outputs.labels }} | |
- name: Attach cdx sbom | |
run: | | |
corepack pnpm install --config.strict-dep-builds=true --package-import-method copy | |
node bin/cdxgen.js -t docker -o cdxgen-secure-oci-image.cdx.json ghcr.io/cyclonedx/cdxgen-secure:latest | |
oras attach --artifact-type sbom/cyclonedx ghcr.io/cyclonedx/cdxgen-secure:latest ./cdxgen-secure-oci-image.cdx.json:application/json | |
oras discover --format tree ghcr.io/cyclonedx/cdxgen-secure:latest | |
continue-on-error: true | |
if: startsWith(github.ref, 'refs/tags/') | |
- name: Attach cdx secure sbom to release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
cdxgen-secure-oci-image.cdx.json | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
containers-deno: | |
if: github.repository == 'CycloneDX/cdxgen' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '23.x' | |
registry-url: https://registry.npmjs.org/ | |
- uses: oras-project/setup-oras@v1 | |
- name: Trim CI agent | |
run: | | |
chmod +x contrib/free_disk_space.sh | |
./contrib/free_disk_space.sh | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta2 | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/cyclonedx/cdxgen-deno | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ci/Dockerfile-deno | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta2.outputs.tags }} | |
labels: ${{ steps.meta2.outputs.labels }} | |
containers-ppc64: | |
if: github.repository == 'CycloneDX/cdxgen' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '23.x' | |
registry-url: https://registry.npmjs.org/ | |
- uses: oras-project/setup-oras@v1 | |
- name: Trim CI agent | |
run: | | |
chmod +x contrib/free_disk_space.sh | |
./contrib/free_disk_space.sh | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta3 | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/cyclonedx/cdxgen-ppc64 | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ci/Dockerfile-ppc64 | |
platforms: linux/ppc64le | |
push: true | |
tags: ${{ steps.meta3.outputs.tags }} | |
labels: ${{ steps.meta3.outputs.labels }} | |
cache-from: type=gha,scope=cdxgen-ppc64 | |
cache-to: type=gha,mode=max,scope=cdxgen-ppc64 | |
containers-bun: | |
if: github.repository == 'CycloneDX/cdxgen' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '23.x' | |
registry-url: https://registry.npmjs.org/ | |
- uses: oras-project/setup-oras@v1 | |
- name: Trim CI agent | |
run: | | |
chmod +x contrib/free_disk_space.sh | |
./contrib/free_disk_space.sh | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta5 | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/cyclonedx/cdxgen-bun | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ci/Dockerfile-bun | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta5.outputs.tags }} | |
labels: ${{ steps.meta5.outputs.labels }} |