diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index f596abfcad..0000000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Deploy -on: - workflow_dispatch: -jobs: - deploy: - name: Deploy - runs-on: ubuntu-latest - - steps: - - name: Check out latest - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7.7' - - - name: Set Node Version - uses: actions/setup-node@v3 - with: - node-version: 18.17.1 - - - name: Documentation Site Deploy - env: - HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} - HEROKU_DOCS_APP_NAME: ${{ secrets.HEROKU_DOCS_APP_NAME }} - run: yarn docs:deploy - - - name: Storybook Site Deploy - env: - HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} - HEROKU_STORYBOOK_APP_NAME: ${{ secrets.HEROKU_STORYBOOK_APP_NAME }} - run: yarn storybook:deploy - - - name: SassDocs Site Deploy - env: - HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} - HEROKU_SASSDOCS_APP_NAME: ${{ secrets.HEROKU_SASSDOCS_APP_NAME }} - run: yarn sassdocs:deploy diff --git a/.github/workflows/lint-test-build.yml b/.github/workflows/lint-test-build.yml index 0243ca0596..4c8174a6c1 100644 --- a/.github/workflows/lint-test-build.yml +++ b/.github/workflows/lint-test-build.yml @@ -1,7 +1,9 @@ name: Lint-Test-Build on: + workflow_call: workflow_dispatch: pull_request: + jobs: lint_test_build: name: Lint, Test, Build diff --git a/.github/workflows/release-deploy-v2.yml b/.github/workflows/release-deploy-v2.yml deleted file mode 100644 index c9a9f275bb..0000000000 --- a/.github/workflows/release-deploy-v2.yml +++ /dev/null @@ -1,262 +0,0 @@ -name: 'Release and Deploy v2' - -on: - # Uncomment the line below if you want to run the workflow manually - # and comment out lines 7-9 - # workflow_dispatch: - push: - branches: - - main - -concurrency: - group: ${{ github.ref }} - cancel-in-progress: true - -jobs: - setup: - - runs-on: ubuntu-latest - - steps: - - name: Clone Sage-Lib Repo - uses: actions/checkout@v3 - with: - # pulls all commits (needed for lerna / semantic release to correctly version) - fetch-depth: "0" - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 18.17.1 - - - name: Set NPM Config - run: npm config set '//npm.pkg.github.com/:_authToken' '${{ secrets.ACCESS_TOKEN }}' - - - name: Unsafe Perm set - run: npm config set unsafe-perm true - - - name: Set Bot Name - run: git config user.name "Kajabi Automation Bot" - - - name: Cache Node modules - uses: actions/cache@v3 - id: sage-lib-node-modules - env: - cache-name: sage-lib-node-modules - with: - path: '**/node_modules' - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} - - - name: Install packages - if: steps.sage-lib-node-modules.outputs.cache-hit != true - run: yarn install --frozen-lockfile - - lint: - needs: [setup] - runs-on: ubuntu-latest - - steps: - - name: Check out latest - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 18.17.1 - - - name: Restore Node modules - uses: actions/cache/restore@v3 - id: restore-sage-lib-node-modules - env: - cache-name: sage-lib-node-modules - with: - path: '**/node_modules' - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} - - - name: Install packages - if: steps.restore-sage-lib-node-modules.outputs.cache-hit != true - run: yarn install --frozen-lockfile - - - name: Lint - run: yarn lint - - test: - needs: [setup] - runs-on: ubuntu-latest - - steps: - - name: Check out latest - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 18.17.1 - - - name: Restore Node modules - uses: actions/cache/restore@v3 - id: restore-sage-lib-node-modules - env: - cache-name: sage-lib-node-modules - with: - path: '**/node_modules' - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} - - - name: Install packages - if: steps.restore-sage-lib-node-modules.outputs.cache-hit != true - run: yarn install --frozen-lockfile - - - name: Test - run: yarn test - - build: - needs: [setup] - runs-on: ubuntu-latest - - steps: - - name: Check out latest - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 18.17.1 - - - name: Restore Node modules - uses: actions/cache/restore@v3 - id: restore-sage-lib-node-modules - env: - cache-name: sage-lib-node-modules - with: - path: '**/node_modules' - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} - - - name: Install packages - if: steps.restore-sage-lib-node-modules.outputs.cache-hit != true - run: yarn install --frozen-lockfile - - - name: Build - run: yarn build - - - name: Cache build assets - uses: actions/cache/save@v3 - id: sage-lib-build-assets - env: - cache-name: sage-lib-build-assets - with: - path: | - 'packages/**' - 'docs/**' - key: ${{ runner.os }}-build-${{ env.cache-name }} - - - publish: - needs: [lint, test, build] - runs-on: ubuntu-latest - - steps: - - name: Check out latest - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7.7' - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 18.17.1 - - - name: Restore Node modules - uses: actions/cache/restore@v3 - id: restore-sage-lib-node-modules - env: - cache-name: sage-lib-node-modules - with: - path: '**/node_modules' - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} - - - name: Check cache hit - if: steps.restore-sage-lib-node-modules.outputs.cache-hit != 'true' - run: exit 1 - - - name: Set Bot Email - run: git config user.email "dev+github-bot@kajabi.com" - - - name: Set Bot Name - run: git config user.name "Kajabi Automation Bot" - - - name: Set NPM Config - run: npm config set '//npm.pkg.github.com/:_authToken' '${{ secrets.ACCESS_TOKEN }}' - - - name: Unsafe Perm set - run: npm config set unsafe-perm true - - - name: Restore Build assets - uses: actions/cache/restore@v3 - id: restore-sage-lib-build-assets - env: - cache-name: sage-lib-build-assets - with: - path: | - 'packages/**' - 'docs/**' - key: ${{ runner.os }}-build-${{ env.cache-name }} - - - name: Check Build Assets cache hit - if: steps.restore-sage-lib-build-assets.outputs.cache-hit != 'true' - continue-on-error: true - run: yarn build - - - name: Lerna Boostrap - run: npx lerna bootstrap --ci - - - name: Lerna Publish - run: npx lerna publish --registry github --yes - - deploy-sites: - needs: publish - runs-on: ubuntu-latest - - steps: - - name: Check out latest - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7.7' - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 18.17.1 - - - name: Deploy Documentation Site - env: - HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} - HEROKU_DOCS_APP_NAME: ${{ secrets.HEROKU_DOCS_APP_NAME }} - run: yarn docs:deploy - - - name: Deploy Storybook Site - env: - HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} - HEROKU_STORYBOOK_APP_NAME: ${{ secrets.HEROKU_STORYBOOK_APP_NAME }} - run: yarn storybook:deploy - - - name: SassDocs Site Deploy - env: - HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} - HEROKU_SASSDOCS_APP_NAME: ${{ secrets.HEROKU_SASSDOCS_APP_NAME }} - run: yarn sassdocs:deploy diff --git a/.github/workflows/release-deploy-v3.yml b/.github/workflows/release-deploy-v3.yml deleted file mode 100644 index cdb1b1c290..0000000000 --- a/.github/workflows/release-deploy-v3.yml +++ /dev/null @@ -1,262 +0,0 @@ -# Disabling until release-please is resolved -# see .github/workflows/release-please.yml for more information -name: 'Release and Deploy v3 - NOT IN USE' - -on: - workflow_call: - # push: - # branches: - # - main - -concurrency: - group: ${{ github.ref }} - cancel-in-progress: true - -jobs: - setup: - - runs-on: ubuntu-latest - - steps: - - name: Clone Sage-Lib Repo - uses: actions/checkout@v3 - with: - # pulls all commits (needed for lerna / semantic release to correctly version) - fetch-depth: "0" - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 18.17.1 - - - name: Set NPM Config - run: npm config set '//npm.pkg.github.com/:_authToken' '${{ secrets.ACCESS_TOKEN }}' - - - name: Unsafe Perm set - run: npm config set unsafe-perm true - - - name: Set Bot Name - run: git config user.name "Kajabi Automation Bot" - - - name: Cache Node modules - uses: actions/cache@v3 - id: sage-lib-node-modules - env: - cache-name: sage-lib-node-modules - with: - path: '**/node_modules' - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} - - - name: Install packages - if: steps.sage-lib-node-modules.outputs.cache-hit != true - run: yarn install --frozen-lockfile - - lint: - needs: [setup] - runs-on: ubuntu-latest - - steps: - - name: Check out latest - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 18.17.1 - - - name: Restore Node modules - uses: actions/cache/restore@v3 - id: restore-sage-lib-node-modules - env: - cache-name: sage-lib-node-modules - with: - path: '**/node_modules' - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} - - - name: Install packages - if: steps.restore-sage-lib-node-modules.outputs.cache-hit != true - run: yarn install --frozen-lockfile - - - name: Lint - run: yarn lint - - test: - needs: [setup] - runs-on: ubuntu-latest - - steps: - - name: Check out latest - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 18.17.1 - - - name: Restore Node modules - uses: actions/cache/restore@v3 - id: restore-sage-lib-node-modules - env: - cache-name: sage-lib-node-modules - with: - path: '**/node_modules' - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} - - - name: Install packages - if: steps.restore-sage-lib-node-modules.outputs.cache-hit != true - run: yarn install --frozen-lockfile - - - name: Test - run: yarn test - - build: - needs: [setup] - runs-on: ubuntu-latest - - steps: - - name: Check out latest - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 18.17.1 - - - name: Restore Node modules - uses: actions/cache/restore@v3 - id: restore-sage-lib-node-modules - env: - cache-name: sage-lib-node-modules - with: - path: '**/node_modules' - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} - - - name: Install packages - if: steps.restore-sage-lib-node-modules.outputs.cache-hit != true - run: yarn install --frozen-lockfile - - - name: Build - run: yarn build - - - name: Cache build assets - uses: actions/cache/save@v3 - id: sage-lib-build-assets - env: - cache-name: sage-lib-build-assets - with: - path: | - 'packages/**' - 'docs/**' - key: ${{ runner.os }}-build-${{ env.cache-name }} - - - publish: - needs: [lint, test, build] - runs-on: ubuntu-latest - - steps: - - name: Check out latest - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7.7' - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 18.17.1 - - - name: Restore Node modules - uses: actions/cache/restore@v3 - id: restore-sage-lib-node-modules - env: - cache-name: sage-lib-node-modules - with: - path: '**/node_modules' - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} - - - name: Check cache hit - if: steps.restore-sage-lib-node-modules.outputs.cache-hit != 'true' - run: exit 1 - - - name: Set Bot Email - run: git config user.email "dev+github-bot@kajabi.com" - - - name: Set Bot Name - run: git config user.name "Kajabi Automation Bot" - - - name: Set NPM Config - run: npm config set '//npm.pkg.github.com/:_authToken' '${{ secrets.ACCESS_TOKEN }}' - - - name: Unsafe Perm set - run: npm config set unsafe-perm true - - - name: Restore Build assets - uses: actions/cache/restore@v3 - id: restore-sage-lib-build-assets - env: - cache-name: sage-lib-build-assets - with: - path: | - 'packages/**' - 'docs/**' - key: ${{ runner.os }}-build-${{ env.cache-name }} - - - name: Check Build Assets cache hit - if: steps.restore-sage-lib-build-assets.outputs.cache-hit != 'true' - continue-on-error: true - run: yarn build - - - name: Lerna Boostrap - run: npx lerna bootstrap --ci - - - name: Lerna Publish - run: npx lerna publish from-package --no-push --registry github --yes - - deploy-sites: - needs: publish - runs-on: ubuntu-latest - - steps: - - name: Check out latest - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7.7' - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 18.17.1 - - - name: Deploy Documentation Site - env: - HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} - HEROKU_DOCS_APP_NAME: ${{ secrets.HEROKU_DOCS_APP_NAME }} - run: yarn docs:deploy - - - name: Deploy Storybook Site - env: - HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} - HEROKU_STORYBOOK_APP_NAME: ${{ secrets.HEROKU_STORYBOOK_APP_NAME }} - run: yarn storybook:deploy - - - name: SassDocs Site Deploy - env: - HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} - HEROKU_SASSDOCS_APP_NAME: ${{ secrets.HEROKU_SASSDOCS_APP_NAME }} - run: yarn sassdocs:deploy diff --git a/.github/workflows/release-deploy.yml b/.github/workflows/release-deploy.yml new file mode 100644 index 0000000000..d353c07491 --- /dev/null +++ b/.github/workflows/release-deploy.yml @@ -0,0 +1,154 @@ +name: Release-Deploy +on: + # !!Emergency override!! uncomment below and access the actions tab in GitHub to run a release/deploy + # workflow_dispatch: + push: + branches: + - main + - develop + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +jobs: + lint-test-build: + uses: ./.github/workflows/lint-test-build.yml + + setup: + needs: [lint-test-build] + runs-on: ubuntu-latest + outputs: + postfix: ${{ env.postfix }} + gitsha: ${{ steps.gitsha.outputs.value }} + steps: + # # Setup Auth token to push to github packages + - name: Set NPM Config + run: npm config set '//npm.pkg.github.com/:_authToken' '${{ secrets.ACCESS_TOKEN }}' + + - name: Add safe directory + run: git config --global --add safe.directory /__w/sage-lib/sage-lib + + - name: Clone Sage-Lib Repo + uses: actions/checkout@v2 + with: + # pulls all commits (needed for lerna / semantic release to correctly version) + fetch-depth: "0" + + # Setup Git Credentials to come from the Bot + - name: Set Bot Email + run: git config user.email "dev+github-bot@kajabi.com" + + - name: Set Bot Name + run: git config user.name "Kajabi Automation Bot" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + with: + version: v0.9.1 + + - name: Determine git sha to checkout + uses: haya14busa/action-cond@v1 + id: gitsha + with: + cond: ${{ github.event_name == 'pull_request' }} + if_true: ${{ github.event.pull_request.head.sha }} + if_false: ${{ github.sha }} + + # Envs based on the current branch + - name: Branch Env + id: branch_env + run: | + echo "Running on branch " + if [ "${{ github.ref }}" == "refs/heads/develop" ]; then + echo "postfix=staging" >> $GITHUB_ENV + elif [ "${{ github.ref }}" == "refs/heads/main" ]; then + echo "postfix=production" >> $GITHUB_ENV + else + echo "postfix=staging" >> $GITHUB_ENV + fi + + build_and_push: + needs: [setup] + runs-on: ubuntu-latest + steps: + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.SAGE_ECR_AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.SAGE_ECR_AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + role-duration-seconds: 1200 + role-session-name: SageECRPushSession + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + with: + mask-password: true + + - name: Set branch name if not PR + if: github.event_name != 'pull_request' + run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV + + - name: Set branch name if PR + if: github.event_name == 'pull_request' + run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_ENV + + - name: Set valid docker tag branch name + run: echo "DOCKER_BRANCH_NAME=$(echo $BRANCH_NAME | sed "s/[^[:alnum:]\-\.\_]/-/g")-$GITHUB_RUN_NUMBER" >> $GITHUB_ENV + + - name: Checkout + uses: actions/checkout@v2 + + # Docs Site + - name: Build and push docs site + uses: docker/build-push-action@v2 + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY_SAGE_DOCS }} + IMAGE_SHA_TAG: ${{ needs.setup.outputs.gitsha }} + POSTFIX: ${{ needs.setup.outputs.postfix }} + with: + file: ./docs/Dockerfile + build-args: | + GITHUB_TOKEN=${{ secrets.ACCESS_TOKEN }} + context: ./docs + push: true + tags: | + ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_SHA_TAG }}-release-${{ env.POSTFIX }} + + # Storybook Site + - name: Build and push storybook + uses: docker/build-push-action@v2 + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY_SAGE_STORYBOOK }} + IMAGE_SHA_TAG: ${{ needs.setup.outputs.gitsha }} + POSTFIX: ${{ needs.setup.outputs.postfix }} + with: + file: ./packages/sage-react/Dockerfile + build-args: | + GITHUB_TOKEN=${{ secrets.ACCESS_TOKEN }} + context: ./packages/sage-react/ + push: true + tags: | + ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_SHA_TAG }}-release-${{ env.POSTFIX }} + + # Sassdocs Site + - name: Build and push sassdocs + uses: docker/build-push-action@v2 + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY_SAGE_SASSDOCS }} + IMAGE_SHA_TAG: ${{ needs.setup.outputs.gitsha }} + POSTFIX: ${{ needs.setup.outputs.postfix }} + with: + file: ./packages/sage-assets/Dockerfile + build-args: | + GITHUB_TOKEN=${{ secrets.ACCESS_TOKEN }} + context: ./packages/sage-assets/ + push: true + tags: | + ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_SHA_TAG }}-release-${{ env.POSTFIX }} diff --git a/.github/workflows/tag-release-image.yml b/.github/workflows/tag-release-image.yml new file mode 100644 index 0000000000..9d5bbc4858 --- /dev/null +++ b/.github/workflows/tag-release-image.yml @@ -0,0 +1,82 @@ +name: Tag Release Image +on: + workflow_dispatch: + inputs: + image_tag: + description: SHA of commit to deploy + required: true + environment: + description: Optional environment to specify release for + required: false + default: development +jobs: + tag_release_image: + name: Tag and push Sage images for release + runs-on: ubuntu-latest + steps: + - name: Determine release tag suffix + uses: haya14busa/action-cond@v1 + id: release_tag_suffix + with: + cond: ${{ github.event.inputs.environment == 'production' }} + if_true: 'release' + if_false: 'release-${{ github.event.inputs.environment }}' + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.SAGE_ECR_AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.SAGE_ECR_AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + role-duration-seconds: 1200 + role-session-name: SageECRPushSession + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + with: + version: v0.9.1 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Retag Documentation image on ECR + uses: akhilerm/tag-push-action@v2.0.0 + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY_SAGE_DOCS }} + IMAGE_TAG: ${{ github.event.inputs.image_tag }} + RELEASE_TAG: ${{ github.event.inputs.image_tag }}-${{ steps.release_tag_suffix.outputs.value }} + with: + src: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY_SAGE_DOCS }}:${{ env.IMAGE_TAG }} + dst: | + ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY_SAGE_DOCS }}:${{ env.RELEASE_TAG }} + ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY_SAGE_DOCS }}:${{ steps.release_tag_suffix.outputs.value }} + + - name: Retag Sassdocs image on ECR + uses: akhilerm/tag-push-action@v2.0.0 + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY_SAGE_SASSDOCS }} + IMAGE_TAG: ${{ github.event.inputs.image_tag }} + RELEASE_TAG: ${{ github.event.inputs.image_tag }}-${{ steps.release_tag_suffix.outputs.value }} + with: + src: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY_SAGE_SASSDOCS }}:${{ env.IMAGE_TAG }} + dst: | + ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY_SAGE_SASSDOCS }}:${{ env.RELEASE_TAG }} + ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY_SAGE_SASSDOCS }}:${{ steps.release_tag_suffix.outputs.value }} + + - name: Retag Storybook image on ECR + uses: akhilerm/tag-push-action@v2.0.0 + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY_SAGE_STORYBOOK }} + IMAGE_TAG: ${{ github.event.inputs.image_tag }} + RELEASE_TAG: ${{ github.event.inputs.image_tag }}-${{ steps.release_tag_suffix.outputs.value }} + with: + src: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY_SAGE_STORYBOOK }}:${{ env.IMAGE_TAG }} + dst: | + ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY_SAGE_STORYBOOK }}:${{ env.RELEASE_TAG }} + ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY_SAGE_STORYBOOK }}:${{ steps.release_tag_suffix.outputs.value }} diff --git a/docs/Dockerfile b/docs/Dockerfile index 1d981253fb..8faf02666d 100644 --- a/docs/Dockerfile +++ b/docs/Dockerfile @@ -8,6 +8,10 @@ ARG NODE_VERSION="16.20.2" ARG YARN_VERSION="1.22.18" ARG ARCH="x64" ARG GITHUB_TOKEN +ARG SECRET_KEY_BASE="setting_random_secret_for_asset_precompile" + +ENV SECRET_KEY_BASE=$SECRET_KEY_BASE +ENV RAILS_ENV=$RAILS_ENV RUN apk add \ bash \ @@ -34,28 +38,24 @@ ENV HOME="/app" ENV BUNDLE_PATH="/app/vendor/gems" ENV BUNDLE_APP_CONFIG="/app/.bundle" - -RUN gem update --system RUN gem install bundler:$BUNDLER_VERSION COPY Gemfile Gemfile.lock ./ -# ISSUE - why is this being run twice... TODO delete -# RUN gem install bundler - RUN if [[ "$RAILS_ENV" == "production" ]]; then bundle config set --local without 'development test'; fi COPY --chown=${NONROOT_UID}:${NONROOT_GID} . . RUN bundle install -RUN echo "-----> Using .npmrc from config " +RUN echo "-----> Using .npmrc from config" +RUN npm config set @kajabi:registry https://npm.pkg.github.com RUN npm config set '//npm.pkg.github.com/:_authToken' '${GITHUB_TOKEN}' +RUN bundle exec rails assets:precompile RUN yarn install --check-files -RUN bundle exec rails assets:precompile SECRET_KEY_BASE=foobarbaz EXPOSE 3000 -CMD ["bundle", "exec", "rails", "s", "-b", "0.0.0.0"] +CMD bundle exec rails s -b 0.0.0.0 -e $RAILS_ENV diff --git a/docs/config/application.rb b/docs/config/application.rb index 53d531cea5..043dd00f2a 100644 --- a/docs/config/application.rb +++ b/docs/config/application.rb @@ -33,9 +33,10 @@ class Application < Rails::Application # config.active_record.raise_in_transactional_callbacks = true # Storybook deploy url to differentiate in different environments - config.storybook_root_url = "https://sage-lib-storybook.herokuapp.com/?path=/docs/" + config.storybook_root_url = "https://sage-lib-storybook.production.kajabi.farm/?path=/docs/" # Sassdocs deploy url to differentiate in different environments - config.sassdocs_root_url = "https://sage-lib-sassdocs.herokuapp.com/" + config.sassdocs_root_url = "https://sage-lib-sassdocs.production.kajabi.farm/" end end + diff --git a/docs/config/environments/staging.rb b/docs/config/environments/staging.rb index 6e6ac0818d..681cf534c9 100644 --- a/docs/config/environments/staging.rb +++ b/docs/config/environments/staging.rb @@ -5,5 +5,5 @@ config.storybook_root_url = "https://sage-lib-storybook.staging.kajabi.farm/?path=/docs/" # Sassdocs deploy url to differentiate in different environments - config.sassdocs_root_url = "https://sage-lib-documentation.staging.kajabi.farm/pages/index" + config.sassdocs_root_url = "https://sage-lib-sassdocs.staging.kajabi.farm/pages/index" end diff --git a/docs/package.json b/docs/package.json index 03126022da..1302eac042 100644 --- a/docs/package.json +++ b/docs/package.json @@ -37,6 +37,7 @@ "dependencies": { "@babel/core": "^7.12.3", "@babel/plugin-transform-runtime": "^7.12.1", + "@babel/plugin-proposal-private-property-in-object": "^7.21.11", "@kajabi/sage-packs": "^1.0.53", "@rails/webpacker": "5.2.2", "arrive": "^2.4.1", diff --git a/packages/sage-assets/Dockerfile b/packages/sage-assets/Dockerfile index 0db40ddb58..0af8061a54 100644 --- a/packages/sage-assets/Dockerfile +++ b/packages/sage-assets/Dockerfile @@ -7,7 +7,6 @@ ARG NODE_VERSION="16.20.2" ARG YARN_VERSION="1.22.18" ARG ARCH="x64" - RUN apk add \ bash \ build-base \ diff --git a/packages/sage-react/Dockerfile b/packages/sage-react/Dockerfile index 3ec4b59a6a..0d05865ed4 100644 --- a/packages/sage-react/Dockerfile +++ b/packages/sage-react/Dockerfile @@ -38,11 +38,12 @@ RUN npm config set @kajabi:registry https://npm.pkg.github.com RUN npm config set '//npm.pkg.github.com/:_authToken' '${GITHUB_TOKEN}' COPY --chown={$NONROOT_UID}:${NONROOT_GID} package.json /app/package.json -RUN yarn +RUN yarn install --check-files COPY --chown={$NONROOT_UID}:${NONROOT_GID} .babelrc /app/.babelrc COPY --chown={$NONROOT_UID}:${NONROOT_GID} lib /app/lib COPY --chown={$NONROOT_UID}:${NONROOT_GID} .storybook /app/.storybook +COPY --chown={$NONROOT_UID}:${NONROOT_GID} public /app/public EXPOSE $PORT diff --git a/yarn.lock b/yarn.lock index 402d17bca2..934b204bec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -124,6 +124,13 @@ dependencies: "@babel/types" "^7.18.6" +"@babel/helper-annotate-as-pure@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.22.5.tgz#e7f06737b197d580a01edf75d97e2c8be99d3882" + integrity sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg== + dependencies: + "@babel/types" "^7.22.5" + "@babel/helper-builder-binary-assignment-operator-visitor@^7.18.6": version "7.18.9" resolved "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.18.9.tgz" @@ -155,6 +162,21 @@ "@babel/helper-replace-supers" "^7.18.9" "@babel/helper-split-export-declaration" "^7.18.6" +"@babel/helper-create-class-features-plugin@^7.21.0": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.23.9.tgz#fddfdf51fca28f23d16b9e3935a4732690acfad6" + integrity sha512-B2L9neXTIyPQoXDm+NtovPvG6VOLWnaXu3BIeVDWwdKFgG30oNa6CqVGiJPDWQwIAK49t9gnQI9c6K6RzabiKw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.22.5" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-member-expression-to-functions" "^7.23.0" + "@babel/helper-optimise-call-expression" "^7.22.5" + "@babel/helper-replace-supers" "^7.22.20" + "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + semver "^6.3.1" + "@babel/helper-create-regexp-features-plugin@^7.18.6": version "7.18.6" resolved "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.18.6.tgz" @@ -243,6 +265,13 @@ dependencies: "@babel/types" "^7.18.9" +"@babel/helper-member-expression-to-functions@^7.22.15", "@babel/helper-member-expression-to-functions@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.23.0.tgz#9263e88cc5e41d39ec18c9a3e0eced59a3e7d366" + integrity sha512-6gfrPwh7OuT6gZyJZvd6WbTfrqAo7vm4xCzAXOusKqq/vWdKXphTpj5klHKNmRUU6/QRGlBsyU9mAIPaWHlqJA== + dependencies: + "@babel/types" "^7.23.0" + "@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.12.13", "@babel/helper-module-imports@^7.18.6": version "7.18.6" resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz" @@ -271,6 +300,13 @@ dependencies: "@babel/types" "^7.18.6" +"@babel/helper-optimise-call-expression@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.22.5.tgz#f21531a9ccbff644fdd156b4077c16ff0c3f609e" + integrity sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw== + dependencies: + "@babel/types" "^7.22.5" + "@babel/helper-plugin-utils@7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz" @@ -281,6 +317,11 @@ resolved "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.18.9.tgz" integrity sha512-aBXPT3bmtLryXaoJLyYPXPlSD4p1ld9aYeR+sJNOZjJJGiOpb+fKfh3NkcCu7J54nUJwCERPBExCCpyCOHnu/w== +"@babel/helper-plugin-utils@^7.20.2": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz#dd7ee3735e8a313b9f7b05a773d892e88e6d7295" + integrity sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg== + "@babel/helper-remap-async-to-generator@^7.18.6", "@babel/helper-remap-async-to-generator@^7.18.9": version "7.18.9" resolved "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.18.9.tgz" @@ -302,6 +343,15 @@ "@babel/traverse" "^7.18.9" "@babel/types" "^7.18.9" +"@babel/helper-replace-supers@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.22.20.tgz#e37d367123ca98fe455a9887734ed2e16eb7a793" + integrity sha512-qsW0In3dbwQUbK8kejJ4R7IHVGwHJlV6lpG6UA7a9hSa2YEiAib+N1T2kr6PEeUT+Fl7najmSOS6SmAwCHK6Tw== + dependencies: + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-member-expression-to-functions" "^7.22.15" + "@babel/helper-optimise-call-expression" "^7.22.5" + "@babel/helper-simple-access@^7.18.6": version "7.18.6" resolved "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.18.6.tgz" @@ -316,6 +366,13 @@ dependencies: "@babel/types" "^7.18.9" +"@babel/helper-skip-transparent-expression-wrappers@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.22.5.tgz#007f15240b5751c537c40e77abb4e89eeaaa8847" + integrity sha512-tK14r66JZKiC43p8Ki33yLBVJKlQDFoA8GYN67lWCDCqoL6EMMSuM9b+Iff2jHaM/RRFYl7K+iiru7hbRqNx8Q== + dependencies: + "@babel/types" "^7.22.5" + "@babel/helper-split-export-declaration@^7.18.6": version "7.18.6" resolved "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz" @@ -567,6 +624,16 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-private-property-in-object" "^7.14.5" +"@babel/plugin-proposal-private-property-in-object@^7.21.11": + version "7.21.11" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.11.tgz#69d597086b6760c4126525cfa154f34631ff272c" + integrity sha512-0QZ8qP/3RLDVBwBFoWAwCtgcDZJVwA5LUJRZU8x2YFfKNuFq161wK3cuGrALu5yiPu+vzwTAg/sMWVNeWeNyaw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.18.6" + "@babel/helper-create-class-features-plugin" "^7.21.0" + "@babel/helper-plugin-utils" "^7.20.2" + "@babel/plugin-syntax-private-property-in-object" "^7.14.5" + "@babel/plugin-proposal-unicode-property-regex@^7.18.6", "@babel/plugin-proposal-unicode-property-regex@^7.4.4": version "7.18.6" resolved "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.18.6.tgz" @@ -17422,6 +17489,11 @@ semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: resolved "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== +semver@^6.3.1: + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== + semver@^7.1.1, semver@^7.1.3: version "7.5.4" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" @@ -20594,4 +20666,4 @@ zwitch@^1.0.0: zxcvbn@^4.4.2: version "4.4.2" resolved "https://registry.npmjs.org/zxcvbn/-/zxcvbn-4.4.2.tgz" - integrity sha512-Bq0B+ixT/DMyG8kgX2xWcI5jUvCwqrMxSFam7m0lAf78nf04hv6lNCsyLYdyYTrCVMqNDY/206K7eExYCeSyUQ== \ No newline at end of file + integrity sha512-Bq0B+ixT/DMyG8kgX2xWcI5jUvCwqrMxSFam7m0lAf78nf04hv6lNCsyLYdyYTrCVMqNDY/206K7eExYCeSyUQ==