From 8f9f165338ede2cc7ef679752665de704055a62b Mon Sep 17 00:00:00 2001 From: Feng Yu Date: Mon, 11 Jul 2022 17:23:59 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=F0=9F=8E=A1=20allow=20tn-p1=20workflow?= =?UTF-8?q?=5Fdispatch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tn-p1.yml | 36 +++++++++++++++++++++++++++++------- .github/workflows/tn.yml | 13 +++++++++++++ 2 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/tn.yml diff --git a/.github/workflows/tn-p1.yml b/.github/workflows/tn-p1.yml index 80ffe6e0..630d9a36 100644 --- a/.github/workflows/tn-p1.yml +++ b/.github/workflows/tn-p1.yml @@ -1,12 +1,18 @@ name: "tn-p1" on: - push: - branches: - - main - pull_request: - branches: - - "*" + workflow_call: + workflow_dispatch: + inputs: + attestation_ver: + description: "Specific org.tokenscript:attestation version" + required: false + type: string + use_github_packages: + description: "Whether to use github packages for building" + required: false + default: false + type: boolean jobs: tn-p1: @@ -18,7 +24,23 @@ jobs: node-version: 16 cache: "npm" cache-dependency-path: package-lock.json - - run: npm ci + - name: install dependencies + run: | + npm ci + if [ "${USE_GITHUB_PACKAGES}" = "true" ]; then + echo "//npm.pkg.github.com/:_authToken=${GPR_KEY}" >> .npmrc + echo "@tokenscript:registry=https://npm.pkg.github.com" >> .npmrc + cat .npmrc + fi + if [ -n "${ATTESTATION_VER}" ]; then + npm i -E "@tokenscript/attestation@${ATTESTATION_VER}" + cat package.json + fi + env: + ATTESTATION_VER: ${{ inputs.attestation_ver }} + USE_GITHUB_PACKAGES: ${{ inputs.use_github_packages }} + GPR_USER: ${{ secrets.GPR_USER }} + GPR_KEY: ${{ secrets.GPR_KEY }} - name: build run: npm run build - name: test diff --git a/.github/workflows/tn.yml b/.github/workflows/tn.yml new file mode 100644 index 00000000..35e76059 --- /dev/null +++ b/.github/workflows/tn.yml @@ -0,0 +1,13 @@ +name: "Token Negotiator CI" + +on: + push: + branches: + - main + pull_request: + branches: + - "*" + +jobs: + tn-p1: + uses: ./.github/workflows/tn-p1.yml