From 85d2b0a66f94ab99facca20180926c0bcfea044e Mon Sep 17 00:00:00 2001 From: SethK Date: Thu, 28 Mar 2024 17:09:21 +0530 Subject: [PATCH] chore:Added stage CI/CI pipeline --- .github/workflows/deploy_stage.yml | 26 ++++++++++++++++++++++++++ package.json | 1 + scripts/cache.js | 5 +++++ scripts/publish.js | 9 +++++++++ src/config.ts | 2 +- 5 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy_stage.yml diff --git a/.github/workflows/deploy_stage.yml b/.github/workflows/deploy_stage.yml new file mode 100644 index 00000000..6d85b380 --- /dev/null +++ b/.github/workflows/deploy_stage.yml @@ -0,0 +1,26 @@ +name: filestack-js-stage +on: + push: + branches: [ stage ] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup repository env + uses: actions/setup-node@v1 + with: + node-version: '14.x' + registry-url: "https://registry.npmjs.org" + - name: Install deps + run: npm install --ignore-scripts + - name: Run tests + run: npm test + - name: Prepare docs + run: npm run docs + - name: Publish package to cdn - stage version + run: npm run publish:s3:stage + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: ${{ secrets.AWS_REGION }} diff --git a/package.json b/package.json index 6d441298..d35d35d7 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "release": "standard-version", "prepare": "npm run build", "publish:s3:beta": "npm run build && node scripts/publish.js --beta", + "publish:s3:stage": "npm run build && node scripts/publish.js --stage", "publish:s3": "node scripts/publish.js --current --latest", "cache:clean": "node scripts/cache.js --current --latest", "cache:clean:beta": "node scripts/cache.js --beta", diff --git a/scripts/cache.js b/scripts/cache.js index d630a43e..514cc6f8 100644 --- a/scripts/cache.js +++ b/scripts/cache.js @@ -61,5 +61,10 @@ const purge = (bucket, path) => { paths.push(`filestack-js/beta`) } + if (args.indexOf('--stage') > -1) { + console.log(`clearing cache for stage version`); + paths.push(`filestack-js/stage`) + } + Promise.all(paths.map((p) => purge(bucket, p)), (res) => console.log(res)) })(); diff --git a/scripts/publish.js b/scripts/publish.js index b25b0ca5..d5ff62c5 100644 --- a/scripts/publish.js +++ b/scripts/publish.js @@ -118,5 +118,14 @@ const upload = async (bucket, path, cacheControll) => { }) } + if (args.indexOf('--stage') > -1) { + console.log(`publish stage version`); + paths.push({ + bucket, + path: `filestack-js/stage`, + cacheControll: 0 + }) + } + Promise.all(paths.map((data) => upload(data.bucket, data.path, data.cacheControll))).then((res) => console.log(res)) })(); diff --git a/src/config.ts b/src/config.ts index 4fb1bdd8..db07d930 100644 --- a/src/config.ts +++ b/src/config.ts @@ -18,7 +18,7 @@ /** * @private */ -const PICKER_VERSION = '1.26.2'; +const PICKER_VERSION = 'stage'; /** * @private