-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split deployment flow and check links
- Loading branch information
Showing
2 changed files
with
99 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,42 +88,10 @@ jobs: | |
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
if: ${{ github.ref == 'refs/heads/master' }} | ||
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 | ||
|
||
check_links: | ||
name: Check links | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Download site | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: site.zip | ||
path: . | ||
|
||
- name: Unzip | ||
run: unzip site.zip | ||
|
||
- name: Restore lychee cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: .lycheecache | ||
key: cache-lychee-${{ github.sha }} | ||
restore-keys: cache-lychee- | ||
|
||
- name: Run lychee for emails | ||
uses: lycheeverse/[email protected] | ||
with: | ||
args: --no-progress --exclude "(https?)|(file)://" --cache --max-cache-age 1d '_site/**/*.html' | ||
fail: false | ||
|
||
- name: Run lychee for links | ||
run: lychee --no-progress --exclude-mail --cache --max-cache-age 1d '_site/**/*.html' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: check_links | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- staging | ||
pull_request: | ||
repository_dispatch: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: production | ||
url: https://www.ituob.org | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Pages | ||
id: pages | ||
uses: actions/configure-pages@v3 | ||
|
||
- name: Install AWS CLI | ||
uses: unfor19/install-aws-cli-action@v1 | ||
|
||
- name: Use Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '3.1' | ||
bundler-cache: true | ||
|
||
- name: Use Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
cache: 'npm' | ||
|
||
- name: Checkout data | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.ITUOB_CI_PAT_TOKEN }} | ||
repository: ituob/itu-ob-data | ||
path: data | ||
ref: ${{ needs.set_environment.outputs.data_branch }} | ||
fetch-depth: 1 | ||
|
||
- name: Cache relaton | ||
uses: actions/cache@v3 | ||
with: | ||
path: relaton | ||
key: ${{ runner.os }}-${{ hashFiles('data/**/*.yaml') }} | ||
|
||
- name: Build site | ||
env: | ||
JEKYLL_ENV: production | ||
run: | | ||
make _site | ||
zip -r site.zip _site | ||
- name: Upload site | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: site.zip | ||
path: site.zip | ||
retention-days: 1 | ||
|
||
check_links: | ||
name: Check links | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Download site | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: site.zip | ||
path: . | ||
|
||
- name: Unzip | ||
run: unzip site.zip | ||
|
||
- name: Restore lychee cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: .lycheecache | ||
key: cache-lychee-${{ github.sha }} | ||
restore-keys: cache-lychee- | ||
|
||
- name: Run lychee for emails | ||
uses: lycheeverse/[email protected] | ||
with: | ||
args: --no-progress --exclude "(https?)|(file)://" --cache --max-cache-age 1d '_site/**/*.html' | ||
fail: false | ||
|
||
- name: Run lychee for links | ||
run: lychee --no-progress --exclude-mail --cache --max-cache-age 1d '_site/**/*.html' |