From 7eda4c5f41a02cd2ee4122796464545675da069d Mon Sep 17 00:00:00 2001 From: Bernard Wolff <2744510+bernardwolff@users.noreply.github.com> Date: Mon, 6 Jan 2025 21:27:29 +0000 Subject: [PATCH] switch to github actions --- .circleci/config.yml | 39 -------------------------- .github/workflows/build.yml | 40 ++++++++++++++++++++++++++ .github/workflows/test.yml | 23 +++++++++++++++ .nvmrc | 2 +- Jenkinsfile | 56 ------------------------------------- package.json | 2 +- tools/cdn.sh | 10 +++---- 7 files changed, 70 insertions(+), 102 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/test.yml delete mode 100644 Jenkinsfile diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 652b1605..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,39 +0,0 @@ -# Javascript Node CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-javascript/ for more details -# -version: 2 -jobs: - build: - docker: - # specify the version you desire here - - image: node:erbium - - # Specify service dependencies here if necessary - # CircleCI maintains a library of pre-built images - # documented at https://circleci.com/docs/2.0/circleci-images/ - # - image: circleci/mongo:3.4.4 - - #working_directory: ~/repo - - steps: - - checkout - - # Download and cache dependencies - - restore_cache: - keys: - - v1-dependencies-{{ checksum "package.json" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- - - - run: yarn - - - save_cache: - paths: - - node_modules - key: v1-dependencies-{{ checksum "package.json" }} - - # run tests! - - run: yarn run lint - - run: yarn test - - run: ./test/bundle_test.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..45ce3c9a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,40 @@ +name: Build + +on: + push: + branches: [ master ] + +permissions: + id-token: write + contents: read + +env: + AWS_ROLE: ${{ secrets.awsIAMS3UploadRole }} + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: '10' + + - name: Install dependencies + run: yarn + + - name: Run Build + run: yarn run build + + - name: Configure AWS Credentials using OIDC + uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4 on 2025-01-06 + with: + role-to-assume: ${{ env.AWS_ROLE }} + role-session-name: github-action-account-link-extension-publish + aws-region: us-west-1 + + - name: Run Deploy + run: sh tools/cdn.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..b8882de2 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,23 @@ +name: Test + +on: + push: + branches-ignore: [ master ] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: '10' + + - name: Install dependencies + run: yarn + + - name: Run Tests + run: yarn run test \ No newline at end of file diff --git a/.nvmrc b/.nvmrc index 12e41412..f599e28b 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -6.9 +10 diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 70ba9f6e..00000000 --- a/Jenkinsfile +++ /dev/null @@ -1,56 +0,0 @@ -pipeline { - agent { - label 'crew-keystone' - } - tools { nodejs '8.11.3' } - stages { - stage('Checkout') { - steps { - checkout scm - } - } - - stage('Installing dependencies') { - steps { - sh 'yarn' - } - } - - stage('Running tests') { - steps { - sh 'yarn test' - } - } - - stage('Build') { - steps { - sh 'yarn run build' - } - } - - stage('Deploy') { - steps { - sh 'tools/cdn.sh' - } - } - } - - post { - // Always runs. And it runs before any of the other post conditions. - always { - // Let's wipe out the workspace before we finish! - deleteDir() - } - } - - // The options directive is for configuration that applies to the whole job. - options { - // For example, we'd like to make sure we only keep 10 builds at a time, so - // we don't fill up our storage! - buildDiscarder(logRotator(numToKeepStr:'10')) - - // And we'd really like to be sure that this build doesn't hang forever, so - // let's time it out after an hour. - timeout(time: 30, unit: 'MINUTES') - } -} diff --git a/package.json b/package.json index 12e85148..122b7ad1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "auth0-account-link-extension", - "version": "2.6.5", + "version": "2.6.6", "description": "Auth0 Account Link Extension", "main": "index.js", "engines": { diff --git a/tools/cdn.sh b/tools/cdn.sh index 63e4c028..a6e8a0e0 100755 --- a/tools/cdn.sh +++ b/tools/cdn.sh @@ -1,19 +1,19 @@ CURRENT_VERSION=$(node tools/attribute.js version) -EXTENSION_NAME="auth0-account-link-extension" +EXTENSION_NAME="auth0-account-link" -CDN_EXISTS=$(aws s3 ls s3://assets.us.auth0.com/css/$EXTENSION_NAME/$CURRENT_VERSION/ | grep "link.min.css") -ADMIN_CDN_EXISTS=$(aws s3 ls s3://assets.us.auth0.com/css/$EXTENSION_NAME/$CURRENT_VERSION/ | grep "admin.min.css") +CDN_EXISTS=$(aws s3 ls s3://assets.us.auth0.com/extensions/$EXTENSION_NAME/assets/ | grep "link.$CURRENT_VERSION.min.css") +ADMIN_CDN_EXISTS=$(aws s3 ls s3://assets.us.auth0.com/extensions/$EXTENSION_NAME/assets/ | grep "admin.$CURRENT_VERSION.min.css") if [ ! -z "$CDN_EXISTS" ]; then echo "There is already a version $CURRENT_VERSION in the cdn. Skipping cdn publish…" else - aws s3 cp public/css/link.min.css s3://assets.us.auth0.com/extensions/$EXTENSION_NAME/$CURRENT_VERSION/link.min.css --region us-west-1 --quiet --cache-control "max-age=86400" --acl public-read + aws s3 cp dist/assets/link.$CURRENT_VERSION.min.css s3://assets.us.auth0.com/extensions/$EXTENSION_NAME/assets/link.$CURRENT_VERSION.min.css --region us-west-1 --cache-control "max-age=86400" --acl public-read echo "$CURRENT_VERSION uploaded to the cdn" fi if [ ! -z "$ADMIN_CDN_EXISTS" ]; then echo "There is already a version $CURRENT_VERSION in the cdn. Skipping cdn publish…" else - aws s3 cp public/css/admin.min.css s3://assets.us.auth0.com/extensions/$EXTENSION_NAME/$CURRENT_VERSION/admin.min.css --region us-west-1 --quiet --cache-control "max-age=86400" --acl public-read + aws s3 cp dist/assets/admin.$CURRENT_VERSION.min.css s3://assets.us.auth0.com/extensions/$EXTENSION_NAME/assets/admin.$CURRENT_VERSION.min.css --region us-west-1 --cache-control "max-age=86400" --acl public-read echo "$CURRENT_VERSION uploaded to the cdn" fi