diff --git a/.github/workflows/build_deploy.yml b/.github/workflows/build_deploy.yml new file mode 100644 index 0000000..7266616 --- /dev/null +++ b/.github/workflows/build_deploy.yml @@ -0,0 +1,66 @@ +name: build_deploy + +on: + schedule: + - cron: '42 */12 * * *' + push: + branches: + - master + pull_request: + repository_dispatch: + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + environment: + name: production + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Pages + id: pages + uses: actions/configure-pages@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: '14.x' + cache: 'yarn' + + - name: Install dependencies + run: yarn install + + - name: Build site + run: yarn compile && yarn build + + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + path: dist/ + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + if: ${{ github.ref == 'refs/heads/master' }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 diff --git a/.github/workflows/deploy-master.yml b/.github/workflows/deploy-master.yml deleted file mode 100644 index 1ef1827..0000000 --- a/.github/workflows/deploy-master.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: deploy-master - -on: - schedule: - - cron: '42 */12 * * *' - push: - branches: [ master ] - workflow_dispatch: - -jobs: - build: - name: Build site - runs-on: ubuntu-latest - environment: - name: production - steps: - - name: Checkout source code - uses: actions/checkout@v3 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: '14.x' - cache: 'yarn' - - - name: Install dependencies - run: yarn install - - - name: Build site - run: yarn compile && yarn build - - - name: Deploy to AWS - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_REGION: ${{ secrets.AWS_REGION }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} - S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }} - run: | - aws configure set default.s3.max_concurrent_requests 100 - aws configure set default.s3.max_queue_size 10000 - aws configure set default.s3.use_accelerate_endpoint true - aws configure set default.s3.payload_signing_enabled false - aws s3 sync dist s3://$S3_BUCKET_NAME --region=$AWS_REGION --delete --no-progress --exclude "*" --include "*.html" --content-type "text/html; charset=utf-8" - aws s3 sync dist s3://$S3_BUCKET_NAME --region=$AWS_REGION --delete --no-progress --exclude "*" --include "*.json" --content-type "application/json; charset=utf-8" - aws s3 sync dist s3://$S3_BUCKET_NAME --region=$AWS_REGION --delete --no-progress --exclude "*" --include "*.jsonld" --content-type "application/ld+json; charset=utf-8" - aws s3 sync dist s3://$S3_BUCKET_NAME --region=$AWS_REGION --delete --no-progress --exclude "*" --include "*.ttl" --content-type "text/turtle; charset=utf-8" - aws s3 sync dist s3://$S3_BUCKET_NAME --region=$AWS_REGION --delete --no-progress --include "*" --exclude "*.html" --exclude "*.json" --exclude "*.jsonld" --exclude "*.ttl" - aws configure set preview.cloudfront true - aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"