From ad24e23864c05fd7f668f43dfbec4279fe386e54 Mon Sep 17 00:00:00 2001 From: KW Kwan Date: Tue, 21 Nov 2023 09:31:55 +0800 Subject: [PATCH 1/2] Move site to Github Pages --- .github/workflows/build.yml | 44 ---------------- .github/workflows/build_deploy.yml | 85 ++++++++++++++++++++++++++++++ .github/workflows/deploy.yml | 57 -------------------- .github/workflows/links.yml | 70 ++++++++++++++++++++++++ 4 files changed, 155 insertions(+), 101 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/build_deploy.yml delete mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/links.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 0dc4e0f..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: build - -on: - push: - branches: - - '*' # matches every branch - - '*/*' # matches every branch containing a single '/' - - '!main' # excludes main - - '!staging' # excludes main - pull_request: - -jobs: - build: - name: Build site - runs-on: ubuntu-latest - steps: - - name: Setup prerequisites - run: | - sudo apt-get update - sudo apt-get install -y curl make libxml2-dev libxslt-dev libnode-dev node-gyp npm openssl xsltproc - - name: Setup snaps - run: | - sudo snap install aws-cli --classic - - uses: actions/checkout@v2 - with: - submodules: true - - name: Use Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7' - bundler-cache: true - - name: Update submodules - run: | - make update-init update-modules - - name: Use Node - uses: actions/setup-node@v1 - with: - node-version: '14.x' - - name: Setup npm - run: | - npm install - - name: Build site - run: | - make _site diff --git a/.github/workflows/build_deploy.yml b/.github/workflows/build_deploy.yml new file mode 100644 index 0000000..fa411c3 --- /dev/null +++ b/.github/workflows/build_deploy.yml @@ -0,0 +1,85 @@ +name: build_deploy + +on: + push: + branches: + - main + # - staging + 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 + steps: + - name: Setup prerequisites + run: | + sudo apt-get update + sudo apt-get install -y curl make libxml2-dev libxslt-dev libnode-dev node-gyp npm openssl xsltproc + + - name: Setup snaps + run: | + sudo snap install aws-cli --classic + + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + cache-version: 0 # Increment this number if you need to re-download cached gems + + - name: Update submodules + run: | + make update-init update-modules + + - name: Use Node + uses: actions/setup-node@v1 + with: + node-version: '14.x' + + - name: Setup npm + run: | + npm install + + - name: Setup Pages + id: pages + uses: actions/configure-pages@v3 + + - name: Build site + run: | + make _site + + - name: Upload artifact + # Automatically uploads an artifact from the './_site' directory by default + uses: actions/upload-pages-artifact@v2 + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + if: ${{ github.ref == 'refs/heads/main' }} + 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.yml b/.github/workflows/deploy.yml deleted file mode 100644 index c65a572..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: deploy - -on: - push: - branches: main - repository_dispatch: - types: [ deploy_main ] - -jobs: - build: - name: Build site - runs-on: ubuntu-latest - environment: - name: production - url: https://schema.unitsml.org - steps: - - name: Setup prerequisites - run: | - sudo apt-get update - sudo apt-get install -y curl make libxml2-dev libxslt-dev libnode-dev node-gyp npm openssl xsltproc - - name: Setup snaps - run: | - sudo snap install aws-cli --classic - - uses: actions/checkout@v2 - with: - submodules: true - - name: Use Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7' - bundler-cache: true - - name: Update submodules - run: | - make update-init update-modules - - name: Use Node - uses: actions/setup-node@v1 - with: - node-version: '14.x' - - name: Setup npm - run: | - npm install - - name: Build site - run: | - make _site - - - 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 s3 sync _site s3://$S3_BUCKET_NAME --region=$AWS_REGION --delete --no-progress --exclude "*" --include "*.html" --content-type "text/html; charset=utf-8" - aws s3 sync _site s3://$S3_BUCKET_NAME --region=$AWS_REGION --delete --no-progress --exclude "*" --include "*.json" --content-type "text/json; charset=utf-8" - aws s3 sync _site s3://$S3_BUCKET_NAME --region=$AWS_REGION --delete --no-progress --exclude "*.html,*.json" --include "*" - aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*" diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml new file mode 100644 index 0000000..684d017 --- /dev/null +++ b/.github/workflows/links.yml @@ -0,0 +1,70 @@ +name: links + +on: + push: + branches: + - main + - staging + pull_request: + + +jobs: + link_checker: + runs-on: ubuntu-latest + steps: + - name: Setup prerequisites + run: | + sudo apt-get update + sudo apt-get install -y curl make libxml2-dev libxslt-dev libnode-dev node-gyp npm openssl xsltproc + + - name: Setup snaps + run: | + sudo snap install aws-cli --classic + + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + cache-version: 0 # Increment this number if you need to re-download cached gems + + - name: Update submodules + run: | + make update-init update-modules + + - name: Use Node + uses: actions/setup-node@v1 + with: + node-version: '14.x' + + - name: Setup npm + run: | + npm install + + - name: Setup Pages + id: pages + uses: actions/configure-pages@v3 + + - name: Build site + run: | + make _site + + - name: Link Checker + uses: lycheeverse/lychee-action@v1.2.0 + with: + args: --verbose --no-progress --exclude-file .lycheeignore -- _site/**/*.html + fail: true + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + + # - name: Create Issue From File + # uses: peter-evans/create-issue-from-file@v2 + # with: + # title: Link Checker Report + # content-filepath: ./lychee/out.md + # labels: report, automated issue From 1acf6e67887d78b38b677d885f8969cacf0a65e2 Mon Sep 17 00:00:00 2001 From: KW Kwan Date: Tue, 21 Nov 2023 10:09:06 +0800 Subject: [PATCH 2/2] Update schemas submodule --- schemas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas b/schemas index 0b34ef9..de01658 160000 --- a/schemas +++ b/schemas @@ -1 +1 @@ -Subproject commit 0b34ef96b36ae6710fe12b2440b5ea2a1555fd85 +Subproject commit de016581e4ab886550608ae26fd457f669b0938f