name: Build And Push Docker Image on: push: paths: - "**" - "!*.md" # CLI is verified separately; its shared Bash upgrade engine ships in images. - "!cli/**" - "cli/src/internal/maintenance/upgradeArtifacts.cjs" - "!.github/workflows/cli-package.yml" branches: - "master" - "develop" tags: - "v*" workflow_dispatch: inputs: static_sync_only: description: Synchronize an existing static snapshot to GitLab and verify Gitee type: boolean default: false static_ref: description: Static branch or version name, for example v2.22.0 type: string default: '' static_ref_type: description: Synchronize a branch, or a version branch and Git tag type: choice options: [branch, tag] default: branch permissions: contents: read jobs: validate: if: ${{ !inputs.static_sync_only }} uses: ./.github/workflows/validate.yml runtime-tools: if: ${{ !inputs.static_sync_only }} uses: ./.github/workflows/runtime-tools.yml code_gitlab: if: ${{ !inputs.static_sync_only }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: fetch-depth: 0 - name: Push to GitLab run: | set +e mkdir -p ~/.ssh printf '%s\n' "${{ secrets.GITLAB_SSH_PK }}" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa ssh-keyscan -T 10 gitlab.com >> ~/.ssh/known_hosts 2>/dev/null git remote add gitlab git@gitlab.com:whyour/qinglong.git 2>/dev/null git push --force --all gitlab 2>&1 || echo "::warning::GitLab push failed" git push --force --tags gitlab 2>&1 || echo "::warning::GitLab tags push failed" build-static: if: ${{ !inputs.static_sync_only }} needs: [validate, runtime-tools] runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: pnpm/action-setup@v6 with: version: "10.34.6" - uses: actions/setup-node@v6 with: node-version: "22" cache: "pnpm" cache-dependency-path: pnpm-lock.yaml - name: build front and back run: | pnpm install --frozen-lockfile pnpm build:front pnpm build:back - uses: actions/download-artifact@v7 with: name: qinglong-runtime-tools-${{ github.sha }} path: static/ - run: pnpm build:info - uses: actions/upload-artifact@v6 with: name: qinglong-static-${{ github.sha }} path: static/ if-no-files-found: error include-hidden-files: true - name: copy to static repo env: GITHUB_REPO: github.com/${{ github.repository_owner }}/qinglong-static GITHUB_BRANCH: ${{ github.ref_name }} GITHUB_REF_TYPE: ${{ github.ref_type }} run: | bash scripts/publish-static.sh "https://${{ secrets.API_TOKEN }}@${GITHUB_REPO}.git" "$GITHUB_BRANCH" "$GITHUB_REF_TYPE" npm-package: if: ${{ !inputs.static_sync_only }} needs: build-static uses: ./.github/workflows/npm-package.yml with: static-artifact: qinglong-static-${{ github.sha }} static_gitlab: needs: build-static runs-on: ubuntu-latest concurrency: group: static-gitlab-${{ github.ref_name }} cancel-in-progress: false steps: - uses: actions/checkout@v6 - name: Push qinglong-static to GitLab env: STATIC_BRANCH: ${{ github.ref_name }} STATIC_REF_TYPE: ${{ github.ref_type }} MIRROR_SSH_KEY: ${{ secrets.GITLAB_SSH_PK }} run: | set -euo pipefail mkdir -p ~/.ssh printf '%s\n' "$MIRROR_SSH_KEY" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa ssh-keyscan -T 10 gitlab.com >> ~/.ssh/known_hosts 2>/dev/null bash scripts/sync-static.sh git@gitlab.com:whyour/qinglong-static.git "$STATIC_BRANCH" "$STATIC_REF_TYPE" verify-gitee-mirrors: needs: build-static runs-on: ubuntu-latest timeout-minutes: 14 permissions: contents: write strategy: fail-fast: false matrix: repository: [qinglong, qinglong-static] steps: - uses: actions/checkout@v6 # Gitee Pull mirrors and GitHub push webhooks own synchronization. # Verification runs alongside Docker builds and needs no Gitee credentials. - name: Wait for Gitee Pull mirror if: ${{ matrix.repository == 'qinglong' }} env: GH_TOKEN: ${{ github.token }} QL_MIRROR_NOTIFY_REPO: whyour/qinglong MIRROR_REPOSITORY: ${{ matrix.repository }} MIRROR_REF: ${{ github.ref_name }} MIRROR_REF_TYPE: ${{ github.ref_type }} QL_MIRROR_INCLUDE_VERSION_BRANCH: ${{ matrix.repository == 'qinglong-static' }} QL_MIRROR_NOTIFY_ON_START: 'false' run: | bash scripts/wait-for-mirror.sh "https://github.com/whyour/$MIRROR_REPOSITORY.git" "https://gitee.com/whyour/$MIRROR_REPOSITORY.git" "$MIRROR_REF" "$MIRROR_REF_TYPE" - name: Notify and wait for Gitee static mirror if: ${{ matrix.repository == 'qinglong-static' }} env: GH_TOKEN: ${{ secrets.API_TOKEN }} QL_MIRROR_NOTIFY_REPO: whyour/qinglong-static MIRROR_REF: ${{ github.ref_name }} MIRROR_REF_TYPE: ${{ github.ref_type }} QL_MIRROR_INCLUDE_VERSION_BRANCH: 'true' run: | bash scripts/wait-for-mirror.sh https://github.com/whyour/qinglong-static.git https://gitee.com/whyour/qinglong-static.git "$MIRROR_REF" "$MIRROR_REF_TYPE" sync-existing-static: if: ${{ github.event_name == 'workflow_dispatch' && inputs.static_sync_only }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: mirror: [gitlab] concurrency: group: static-${{ matrix.mirror }}-${{ inputs.static_ref }} cancel-in-progress: false steps: - uses: actions/checkout@v6 - name: Synchronize existing static snapshot env: STATIC_REF: ${{ inputs.static_ref }} STATIC_REF_TYPE: ${{ inputs.static_ref_type }} MIRROR_HOST: ${{ matrix.mirror }}.com MIRROR_SSH_KEY: ${{ secrets.GITLAB_SSH_PK }} run: | set -euo pipefail mkdir -p ~/.ssh printf '%s\n' "$MIRROR_SSH_KEY" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa ssh-keyscan -T 10 "$MIRROR_HOST" >> ~/.ssh/known_hosts 2>/dev/null bash scripts/sync-static.sh "git@$MIRROR_HOST:whyour/qinglong-static.git" "$STATIC_REF" "$STATIC_REF_TYPE" verify-existing-static-gitee: if: ${{ github.event_name == 'workflow_dispatch' && inputs.static_sync_only }} runs-on: ubuntu-latest timeout-minutes: 14 steps: - uses: actions/checkout@v6 - name: Wait for existing Gitee static snapshot env: GH_TOKEN: ${{ secrets.API_TOKEN }} QL_MIRROR_NOTIFY_REPO: whyour/qinglong-static MIRROR_REF: ${{ inputs.static_ref }} MIRROR_REF_TYPE: ${{ inputs.static_ref_type }} QL_MIRROR_INCLUDE_VERSION_BRANCH: 'true' run: | bash scripts/wait-for-mirror.sh https://github.com/whyour/qinglong-static.git https://gitee.com/whyour/qinglong-static.git "$MIRROR_REF" "$MIRROR_REF_TYPE" build-alpine: if: ${{ !startsWith(github.ref, 'refs/tags/') }} needs: build-static runs-on: ubuntu-22.04 permissions: packages: write contents: read steps: - uses: actions/checkout@v6 - uses: actions/download-artifact@v7 with: name: qinglong-static-${{ github.sha }} path: static/ - uses: pnpm/action-setup@v6 with: version: "10.34.6" - uses: actions/setup-node@v6 with: node-version: "22" cache: "pnpm" cache-dependency-path: pnpm-lock.yaml - name: Read version from version.yaml id: version run: | VERSION=$(grep '^version:' version.yaml | awk '{print $2}') echo "version=$VERSION" >> $GITHUB_OUTPUT - name: Setup timezone run: sudo timedatectl set-timezone Asia/Shanghai - name: Login to DockerHub uses: docker/login-action@v4 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Login to GHCR uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v6 with: images: | ${{ github.repository }} ghcr.io/${{ github.repository }} flavor: | latest=false tags: | type=ref,event=branch,enable=${{ github.ref == format('refs/heads/{0}', 'develop') }} type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }} type=raw,value=${{ steps.version.outputs.version }},enable=${{ github.ref == format('refs/heads/{0}', 'master') }} type=semver,pattern={{version}} - name: Set up QEMU uses: docker/setup-qemu-action@v4 with: cache-image: false - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 - name: Build and push (Alpine) uses: docker/build-push-action@v7 with: build-args: | QL_MAINTAINER=${{ github.repository_owner }} QL_BRANCH=${{ github.ref_name }} SOURCE_COMMIT=${{ github.sha }} network: host platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x,linux/386 context: . file: ./docker/Dockerfile push: true provenance: mode=max sbom: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=registry,ref=whyour/qinglong:cache-alpine cache-to: type=registry,ref=whyour/qinglong:cache-alpine,mode=max build-debian: if: ${{ !startsWith(github.ref, 'refs/tags/') }} needs: build-static runs-on: ubuntu-22.04 permissions: packages: write contents: read steps: - uses: actions/checkout@v6 - uses: actions/download-artifact@v7 with: name: qinglong-static-${{ github.sha }} path: static/ - uses: pnpm/action-setup@v6 with: version: "10.34.6" - uses: actions/setup-node@v6 with: node-version: "22" cache: "pnpm" cache-dependency-path: pnpm-lock.yaml - name: Read version from version.yaml id: version run: | VERSION=$(grep '^version:' version.yaml | awk '{print $2}') echo "version=$VERSION" >> $GITHUB_OUTPUT - name: Setup timezone run: sudo timedatectl set-timezone Asia/Shanghai - name: Login to DockerHub uses: docker/login-action@v4 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Login to GHCR uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v6 with: images: | ${{ github.repository }} ghcr.io/${{ github.repository }} flavor: | latest=false tags: | type=raw,value=debian-dev,enable=${{ github.ref == format('refs/heads/{0}', 'develop') }} type=raw,value=debian,enable=${{ github.ref == format('refs/heads/{0}', 'master') }} type=raw,value=${{ steps.version.outputs.version }}-debian,enable=${{ github.ref == format('refs/heads/{0}', 'master') }} - name: Set up QEMU uses: docker/setup-qemu-action@v4 with: cache-image: false - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 - name: Build and push (Debian) uses: docker/build-push-action@v7 with: build-args: | QL_MAINTAINER=${{ github.repository_owner }} QL_BRANCH=${{ github.ref_name }} SOURCE_COMMIT=${{ github.sha }} network: host # Keep s390x on Debian: npm can hang under QEMU with Alpine (nodejs/docker-node#1973). platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x context: . file: ./docker/Dockerfile.debian push: true provenance: mode=max sbom: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=registry,ref=whyour/qinglong:cache-debian cache-to: type=registry,ref=whyour/qinglong:cache-debian,mode=max build-alpine310: if: ${{ github.ref_name == 'master' }} needs: build-static runs-on: ubuntu-22.04 permissions: packages: write contents: read steps: - uses: actions/checkout@v6 - uses: actions/download-artifact@v7 with: name: qinglong-static-${{ github.sha }} path: static/ - uses: pnpm/action-setup@v6 with: version: "10.34.6" - uses: actions/setup-node@v6 with: node-version: "22" cache: "pnpm" cache-dependency-path: pnpm-lock.yaml - name: Read version from version.yaml id: version run: | VERSION=$(grep '^version:' version.yaml | awk '{print $2}') echo "version=$VERSION" >> $GITHUB_OUTPUT - name: Setup timezone run: sudo timedatectl set-timezone Asia/Shanghai - name: Login to DockerHub uses: docker/login-action@v4 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Login to GHCR uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up QEMU uses: docker/setup-qemu-action@v4 with: cache-image: false - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 - name: Build and push (Alpine Python 3.10) uses: docker/build-push-action@v7 with: build-args: | QL_MAINTAINER=${{ github.repository_owner }} QL_BRANCH=${{ github.ref_name }} SOURCE_COMMIT=${{ github.sha }} network: host platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x,linux/386 context: . file: ./docker/Dockerfile.310 push: true provenance: mode=max sbom: true tags: | whyour/qinglong:python3.10 whyour/qinglong:${{ steps.version.outputs.version }}-python3.10 cache-from: type=registry,ref=whyour/qinglong:cache-alpine-python3.10 cache-to: type=registry,ref=whyour/qinglong:cache-alpine-python3.10,mode=max build-debian310: if: ${{ github.ref_name == 'master' }} needs: build-static runs-on: ubuntu-22.04 permissions: packages: write contents: read steps: - uses: actions/checkout@v6 - uses: actions/download-artifact@v7 with: name: qinglong-static-${{ github.sha }} path: static/ - uses: pnpm/action-setup@v6 with: version: "10.34.6" - uses: actions/setup-node@v6 with: node-version: "22" cache: "pnpm" cache-dependency-path: pnpm-lock.yaml - name: Read version from version.yaml id: version run: | VERSION=$(grep '^version:' version.yaml | awk '{print $2}') echo "version=$VERSION" >> $GITHUB_OUTPUT - name: Setup timezone run: sudo timedatectl set-timezone Asia/Shanghai - name: Login to DockerHub uses: docker/login-action@v4 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Login to GHCR uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up QEMU uses: docker/setup-qemu-action@v4 with: cache-image: false - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 - name: Build and push (Debian Python 3.10) uses: docker/build-push-action@v7 with: build-args: | QL_MAINTAINER=${{ github.repository_owner }} QL_BRANCH=${{ github.ref_name }} SOURCE_COMMIT=${{ github.sha }} network: host # Keep s390x on Debian: npm can hang under QEMU with Alpine (nodejs/docker-node#1973). platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x context: . file: ./docker/Dockerfile.debian310 push: true provenance: mode=max sbom: true tags: | whyour/qinglong:debian-python3.10 whyour/qinglong:${{ steps.version.outputs.version }}-debian-python3.10 cache-from: type=registry,ref=whyour/qinglong:cache-debian-python3.10 cache-to: type=registry,ref=whyour/qinglong:cache-debian-python3.10,mode=max publish: if: ${{ github.repository == 'whyour/qinglong' && github.ref == 'refs/heads/master' }} needs: [build-alpine, build-debian, build-alpine310, build-debian310, npm-package] runs-on: ubuntu-latest timeout-minutes: 10 permissions: contents: read id-token: write env: SOURCE_SHA: ${{ github.sha }} VERIFIED_TARBALL_SHA256: ${{ needs.npm-package.outputs.tarball-sha256 }} VERIFIED_PACKAGE_VERSION: ${{ needs.npm-package.outputs.package-version }} steps: - uses: actions/checkout@v6 with: ref: ${{ github.sha }} - uses: actions/setup-node@v6 with: node-version: '22.23.3' package-manager-cache: false - uses: actions/download-artifact@v7 with: name: ${{ needs.npm-package.outputs.artifact-name }} path: ${{ runner.temp }}/main-npm-publish/ - uses: actions/download-artifact@v7 with: name: qinglong-runtime-tools-${{ github.sha }} path: ${{ runner.temp }}/npm-publisher-runtime-tools/ - name: Verify the gate-approved archive and its source receipts shell: bash run: | set -euo pipefail node <<'NODE' const fs = require('node:fs'), path = require('node:path'), crypto = require('node:crypto'), assert = require('node:assert/strict'); const { spawnSync } = require('node:child_process'); const hash = (bytes) => crypto.createHash('sha256').update(bytes).digest('hex'); const fileHash = (file) => hash(fs.readFileSync(file)); const directory = path.join(process.env.RUNNER_TEMP, 'main-npm-publish'); const summary = JSON.parse(fs.readFileSync(path.join(directory, 'package-build-summary.json'))); const pkg = JSON.parse(fs.readFileSync('package.json')); assert.match(process.env.VERIFIED_TARBALL_SHA256 || '', /^[a-f0-9]{64}$/); assert.equal(summary.sourceCommit, process.env.SOURCE_SHA); assert.equal(summary.previewMetadata, false); assert.deepEqual(summary.sourceMetadataChanges, []); assert(summary.helperProvenance.length > 0); assert(summary.helperProvenance.every((item) => item.matchesGitSource)); assert.equal(summary.package, pkg.name); assert.equal(summary.packageVersion, pkg.version); assert.equal(summary.packageVersion, process.env.VERIFIED_PACKAGE_VERSION); assert.equal(summary.productionManifestSHA256, fileHash('package.json')); assert.equal(summary.productionLockSHA256, fileHash('pnpm-lock.yaml')); const source = spawnSync('git', ['archive', process.env.SOURCE_SHA], { maxBuffer: 128 * 1024 * 1024 }); assert.equal(source.status, 0); assert.equal(hash(source.stdout), summary.sourceArchiveSHA256); assert.equal(summary.runtimeToolsIncluded, true); assert.equal(summary.runtimeTools.sourceCommit, process.env.SOURCE_SHA); assert.equal(summary.runtimeTools.builder.platform, 'linux'); assert.equal(summary.runtimeTools.builder.releaseBuild, true); assert.equal(path.basename(summary.tarball.filename), summary.tarball.filename); assert(summary.tarball.filename.endsWith('.tgz')); assert.deepEqual(fs.readdirSync(directory).filter((name) => name.endsWith('.tgz')), [summary.tarball.filename]); const tarball = path.join(directory, summary.tarball.filename); assert.equal(summary.tarball.sha256, process.env.VERIFIED_TARBALL_SHA256); assert.equal(fileHash(tarball), process.env.VERIFIED_TARBALL_SHA256); assert.equal(fs.statSync(tarball).size, summary.tarball.bytes); const tar = (args) => { const result = spawnSync('tar', args, { maxBuffer: 128 * 1024 * 1024 }); assert.equal(result.status, 0, 'Cannot read the approved archive'); return result.stdout; }; const entries = tar(['-tzf', tarball]).toString().split('\n').filter(Boolean); assert.equal(entries.length, new Set(entries).size); for (const name of entries) assert(name.startsWith('package/') && !name.split('/').includes('..') && !name.endsWith('.node') && !name.split('/').some((part) => ['.npmrc', '.git', '.pnpm', '_cacache'].includes(part)), 'Forbidden archive item ' + name); const read = (relative) => tar(['-xOf', tarball, 'package/' + relative]); const receipt = JSON.parse(read('qinglong-npm-dependency-proof.json')); const { tarball: ignoredTarball, ...producerReceipt } = summary; assert.deepEqual(receipt, producerReceipt); assert.deepEqual(entries.map((name) => name.slice('package/'.length)).sort(), receipt.publishedFilePaths); const published = JSON.parse(read('package.json')); assert.equal(published.name, pkg.name); assert.equal(published.version, pkg.version); assert.equal(hash(read('package.json')), receipt.publishedRootManifestSHA256); const buildInfo = read('static/build-info.json'), build = JSON.parse(buildInfo); assert.equal(hash(buildInfo), summary.ciBuildInfoSHA256); assert.equal(build.sourceCommit, process.env.SOURCE_SHA); assert.equal(build.dirty, false); assert.equal(build.lockfileSha256, summary.productionLockSHA256); assert.deepEqual(entries.filter((name) => name.startsWith('package/static/')).map((name) => name.slice('package/static/'.length)).sort(), [...Object.keys(build.files), 'build-info.json'].sort()); const toolsRoot = path.join(process.env.RUNNER_TEMP, 'npm-publisher-runtime-tools'); for (const [name, expected] of [['runtime-tools.tgz', summary.runtimeTools.archiveSHA256], ['runtime-tools-proof.json', summary.runtimeTools.proofSHA256]]) { assert.equal(fileHash(path.join(toolsRoot, name)), expected); assert.equal(hash(read('static/' + name)), expected); assert.equal(build.files[name], expected); } const tools = JSON.parse(fs.readFileSync(path.join(toolsRoot, 'runtime-tools-proof.json'))); assert.equal(tools.sourceCommit, process.env.SOURCE_SHA); assert.equal(tools.archive.sha256, summary.runtimeTools.archiveSHA256); assert.equal(tools.builder.platform, 'linux'); assert.equal(tools.builder.releaseBuild, true); assert.equal(tools.sourceAttestation.verified, true); assert.equal(tools.sourceAttestation.head, process.env.SOURCE_SHA); assert(tools.inputs.length > 0); for (const input of tools.inputs) { assert(input.path && !path.isAbsolute(input.path) && !input.path.split(/[\\/]/).includes('..')); assert.equal(fileHash(input.path), input.sha256, 'Tool source input changed: ' + input.path); } fs.appendFileSync(process.env.GITHUB_ENV, 'QINGLONG_PUBLISH_TARBALL=' + tarball + '\n'); console.log(JSON.stringify({ sourceCommit: summary.sourceCommit, packageVersion: summary.packageVersion, tarballSHA256: summary.tarball.sha256, cleanSource: true, runtimeToolsIncluded: true })); NODE - name: Install the same fixed npm CLI for trusted publishing run: | node scripts/install-runtime-tools.cjs \ --archive "$RUNNER_TEMP/npm-publisher-runtime-tools/runtime-tools.tgz" \ --proof "$RUNNER_TEMP/npm-publisher-runtime-tools/runtime-tools-proof.json" \ --prefix "$RUNNER_TEMP/npm-publisher-tools" - name: Publish the verified npm archive with OIDC shell: bash run: | set -euo pipefail npm_cli="$RUNNER_TEMP/npm-publisher-tools/lib/node_modules/npm/bin/npm-cli.js" export NPM_CONFIG_USERCONFIG="$RUNNER_TEMP/npm-publish-public.npmrc" export NPM_CONFIG_GLOBALCONFIG=/dev/null export NPM_CONFIG_CACHE="$RUNNER_TEMP/npm-publish-cache" printf 'registry=https://registry.npmjs.org/\n' > "$NPM_CONFIG_USERCONFIG" test "$(node "$npm_cli" --version)" = '12.2.0' name=$(node -p 'require("./package.json").name') version=$(node -p 'require("./package.json").version') if node "$npm_cli" view "$name@$version" version --json --registry=https://registry.npmjs.org > "$RUNNER_TEMP/npm-version.json" 2> "$RUNNER_TEMP/npm-version-error.log"; then jq -e --arg version "$version" '. == $version' "$RUNNER_TEMP/npm-version.json" > /dev/null echo "::notice::$name@$version is already published; skipping npm publication for this image rebuild." elif jq -e '.error.code == "E404"' "$RUNNER_TEMP/npm-version.json" > /dev/null; then node "$npm_cli" publish "$QINGLONG_PUBLISH_TARBALL" --ignore-scripts --access public --registry=https://registry.npmjs.org else echo '::error::Could not check the published npm version; refusing to publish.' exit 1 fi