diff --git a/.github/workflows/auto-deploy-staging.yml b/.github/workflows/auto-deploy-staging.yml deleted file mode 100644 index 370e967c..00000000 --- a/.github/workflows/auto-deploy-staging.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Auto deploy staging AWS -env: - NODE_VERSION: '14.x' - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} -on: - push: - # Sequence of patterns matched against refs/tags - branches: - - main - -jobs: - lint: - name: Lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: ${{env.NODE_VERSION}} - - run: npm ci - - run: npm run lint --if-present - test: - name: Unit Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: ${{env.NODE_VERSION}} - - run: npm ci - - run: npm test --if-present - typeCheck: - name: Type Check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: ${{env.NODE_VERSION}} - - run: npm ci - - run: npm run typeCheck --if-present - - deploy: - needs: [lint, typeCheck, test] - name: Upload to Amazon S3 - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-west-2 - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: ${{env.NODE_VERSION}} - - run: npm ci - - run: npm run build:staging - - name: Copy files to staging bucket - run: aws s3 sync ./dist/ s3://staging.simularium.allencell.org --delete - - name: Clear cloudfront cache - run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CFE_CLOUDFRONT_DISTRIBUTION_ID_STAGING }} --paths "/*" - diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/ci-and-auto-deploy.yml similarity index 61% rename from .github/workflows/deploy-production.yml rename to .github/workflows/ci-and-auto-deploy.yml index 135d7908..b010c663 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/ci-and-auto-deploy.yml @@ -1,11 +1,8 @@ -name: Deploy AWS production +name: Continuous Integration env: NODE_VERSION: '14.x' -on: - push: - # Sequence of patterns matched against refs/tags - tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} +on: [push] jobs: @@ -43,9 +40,35 @@ jobs: - run: npm ci - run: npm run typeCheck --if-present - deploy: + deploy-staging: + if: github.ref == 'refs/heads/main' needs: [lint, typeCheck, test] - name: Upload to Amazon S3 + name: Upload to Amazon S3 Staging + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-west-2 + - name: Setup node + uses: actions/setup-node@v1 + with: + node-version: ${{env.NODE_VERSION}} + - run: npm ci + - run: npm run build:staging + - name: Copy files to staging bucket + run: aws s3 sync ./dist/ s3://staging.simularium.allencell.org --delete + - name: Clear cloudfront cache + run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CFE_CLOUDFRONT_DISTRIBUTION_ID_STAGING }} --paths "/*" + + deploy-production: + if: startsWith(github.ref, 'refs/tags/v') + needs: [lint, typeCheck, test] + name: Upload to Amazon S3 Production runs-on: ubuntu-latest steps: @@ -71,5 +94,3 @@ jobs: status: ${{ job.status }} channel: '#simularium-dev' if: always() - - diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 5dd5a7b6..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,22 +0,0 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Node.js CI - -on: [push] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Use Node.js - uses: actions/setup-node@v1 - with: - node-version: '14.x' - - run: npm ci - - run: npm test --if-present - - run: npm run lint --if-present - - run: npm run typeCheck --if-present diff --git a/.github/workflows/daily-new-viewer.yml b/.github/workflows/daily-new-viewer.yml index 3e02294e..13a58e0f 100644 --- a/.github/workflows/daily-new-viewer.yml +++ b/.github/workflows/daily-new-viewer.yml @@ -3,9 +3,11 @@ name: github pages on: schedule: - cron: "0 0 * * *" + workflow_dispatch: + jobs: - deploy: + build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -16,7 +18,6 @@ jobs: node-version: "14.x" - name: Cache dependencies - uses: actions/cache@v1 with: path: ~/.npm @@ -26,18 +27,25 @@ jobs: - run: npm ci - run: npm i @aics/simularium-viewer@latest - - run: npm run gh-build - - name: Prepare tag - id: prepare_tag - if: startsWith(github.ref, 'refs/tags/') - run: | - TAG_NAME="${GITHUB_REF##refs/tags/}" - echo "::set-output name=tag_name::${TAG_NAME}" - echo "::set-output name=deploy_tag_name::deploy-${TAG_NAME}" + - run: npm run gh-build:stable + - run: npm i https://github.com/simularium/simularium-viewer + - run: npm run gh-build:dev + - name: Upload + uses: actions/upload-artifact@v3 + with: + name: daily-build + path: gh-pages/ + + download-and-deploy: + runs-on: ubuntu-latest + needs: [build] + steps: + - uses: actions/checkout@v2 + - uses: actions/download-artifact@v3 + - name: Display structure of downloaded files + run: ls -R - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./dist - tag_name: ${{ steps.prepare_tag.outputs.deploy_tag_name }} - tag_message: 'Deployment to gh-pages to test new viewer ${{ steps.prepare_tag.outputs.tag_name }}' + publish_dir: ./daily-build diff --git a/.gitignore b/.gitignore index 30766de1..14b5d0f0 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,6 @@ build/ .settings/ .env .vscode/ -coverage/ \ No newline at end of file +coverage/ +dev +stable \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7964e5bb..dacda6d9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,6 +62,10 @@ ___ #### Update Simularium Viewer module Run `npm update` to update dependencies, including simularium-viewer +### Daily builds +[Viewer at development head](https://simularium.github.io/simularium-website/dev) +[Latest released stable viewer](https://simularium.github.io/simularium-website/stable) + #### Staging deployment Automatically builds from `main` diff --git a/gh-pages/index.html b/gh-pages/index.html new file mode 100644 index 00000000..bebdf734 --- /dev/null +++ b/gh-pages/index.html @@ -0,0 +1,19 @@ + + +
+ + + +