phanikumv commented on code in PR #71843: URL: https://github.com/apache/airflow/pull/71843#discussion_r3859967567
########## .github/workflows/ts-sdk-release.yml: ########## @@ -0,0 +1,199 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +--- +name: Release TypeScript SDK + +on: # yamllint disable-line rule:truthy + workflow_dispatch: + inputs: + release_type: + description: "Stage the package for review or publish it directly" + required: true + type: choice + options: + - staged + - formal + tag: + description: "TypeScript SDK release tag (ts-sdk/<version>)" + required: true + type: string + npm_tag: + description: "npm dist-tag (for example: beta or latest)" + required: true + type: string + +permissions: + contents: read + +concurrency: + group: ts-sdk-npm-release + cancel-in-progress: false + +jobs: + build: + name: Verify and package release + runs-on: ubuntu-latest + outputs: + artifact_name: ${{ steps.package.outputs.artifact_name }} + package_file: ${{ steps.release.outputs.package_file }} + sha256: ${{ steps.package.outputs.sha256 }} + version: ${{ steps.release.outputs.version }} + steps: + - name: Checkout dispatched release tag + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + - name: Set up Node.js + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + node-version: "24.19.0" + registry-url: "https://registry.npmjs.org" + package-manager-cache: false + - name: Enable the pinned pnpm version + run: corepack enable + - name: Validate release inputs + id: release + working-directory: ts-sdk + env: + NPM_TAG: ${{ inputs.npm_tag }} + RELEASE_TAG: ${{ inputs.tag }} + run: node scripts/validate-release-inputs.mjs + - name: Confirm dispatch and checkout use the release tag + env: + DISPATCH_REF: ${{ github.ref }} + DISPATCH_SHA: ${{ github.sha }} + RELEASE_TAG: ${{ inputs.tag }} + run: | + set -euo pipefail + test "${DISPATCH_REF}" = "refs/tags/${RELEASE_TAG}" + test "${DISPATCH_SHA}" = "$(git rev-parse HEAD)" + test "$(git rev-parse "refs/tags/${RELEASE_TAG}^{commit}")" = "$(git rev-parse HEAD)" + git merge-base --is-ancestor HEAD "$(git rev-parse refs/remotes/origin/main)" + - name: Confirm release advances the npm dist-tag + working-directory: ts-sdk + env: + NPM_TAG: ${{ inputs.npm_tag }} + RELEASE_TAG: ${{ inputs.tag }} + run: | + set -euo pipefail + error_file="${RUNNER_TEMP}/npm-view-error.log" + set +e + current_version="$(npm view apache-airflow-ts-sdk "dist-tags.${NPM_TAG}" 2>"${error_file}")" + view_status=$? + set -e + if [[ ${view_status} -ne 0 ]]; then + if grep -q "E404" "${error_file}"; then + current_version="" + else + cat "${error_file}" >&2 + exit "${view_status}" + fi + fi + CURRENT_DIST_TAG_VERSION="${current_version}" node scripts/validate-release-inputs.mjs + - name: Verify package identity + working-directory: ts-sdk + env: + EXPECTED_VERSION: ${{ steps.release.outputs.version }} + run: | + set -euo pipefail + test "$(node --print "require('./package.json').name")" = "apache-airflow-ts-sdk" + test "$(node --print "require('./package.json').version")" = "${EXPECTED_VERSION}" + - name: Install and test package + working-directory: ts-sdk + run: | + set -euo pipefail + pnpm install --frozen-lockfile + pnpm run lint + pnpm run format:check + pnpm run typecheck + pnpm test + - name: Create package tarball + id: package + working-directory: ts-sdk + env: + PACKAGE_FILE: ${{ steps.release.outputs.package_file }} + VERSION: ${{ steps.release.outputs.version }} + run: | + set -euo pipefail + artifact_dir="${RUNNER_TEMP}/ts-sdk-package" + mkdir -p "${artifact_dir}" + test -z "$(find "${artifact_dir}" -mindepth 1 -maxdepth 1 -print -quit)" + npm pack --pack-destination "${artifact_dir}" + artifact_path="${artifact_dir}/${PACKAGE_FILE}" + test -f "${artifact_path}" + test "$(find "${artifact_dir}" -maxdepth 1 -type f -name '*.tgz' | wc -l)" -eq 1 + echo "artifact_name=ts-sdk-package-${VERSION}" >> "${GITHUB_OUTPUT}" + echo "sha256=$(sha256sum "${artifact_path}" | awk '{print $1}')" >> "${GITHUB_OUTPUT}" + - name: Upload package tarball + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: ${{ steps.package.outputs.artifact_name }} + path: ${{ runner.temp }}/ts-sdk-package/${{ steps.release.outputs.package_file }} + if-no-files-found: error + retention-days: 1 Review Comment: This is the only workflow in the repo gated on human environment approval, and the only one at 1 day — everything else uses 2 or 7. Retention runs from upload, not from run completion, so any approval that lands more than ~24h after dispatch loses the tarball and forces a full re-dispatch. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
