Repository navigation
80 lines (70 loc) · 2.5 KB
/
Copy pathdeploy.yml
File metadata and controls
80 lines (70 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Build and deploy to Pages
on:
push:
branches: [main]
workflow_dispatch:
# The traffic collector commits data/*.csv with GITHUB_TOKEN, and GitHub
# deliberately does not let GITHUB_TOKEN pushes start further workflow
# runs. Without this the new rows sat in the repository until some other
# push happened to redeploy, so the sidebar sparklines lagged the data.
workflow_run:
workflows: ["Collect GitHub traffic stats", "Approve map pin"]
types: [completed]
permissions:
contents: read
pages: write
id-token: write
# Never cut off a publish that is already running.
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
# A failed collection has nothing new to publish, and republishing on
# one would quietly turn every stats failure into a deploy too.
if: >-
github.event_name != 'workflow_run' ||
github.event.workflow_run.conclusion == 'success'
steps:
- uses: actions/checkout@v5
with:
# On workflow_run, github.sha is the default branch as it stood
# when the collector STARTED, which predates the commit it just
# made — checking that out would deploy the CSVs we are trying to
# refresh. Ask for the branch by name and get its current head.
ref: main
fetch-depth: 0 # needed for the scopus.bib commit date below
# Replaces the Apache SSI <!--#flastmod virtual="scopus.bib" -->
- name: Stamp bibliography date
run: |
mkdir -p _data
printf 'updated: "%s"\n' \
"$(git log -1 --format=%cd --date=format:'%d-%m-%Y' -- scopus.bib)" \
> _data/bib.yml
cat _data/bib.yml
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- uses: actions/configure-pages@v5
id: pages
with:
# Turns Pages on (Source = GitHub Actions) if it is not already.
# Without this the first run 404s: the API has no Pages site to
# describe until one exists.
enablement: true
- name: Build
env:
JEKYLL_ENV: production
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
- uses: actions/upload-pages-artifact@v3
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4