-
Notifications
You must be signed in to change notification settings - Fork 32
65 lines (64 loc) 路 2.09 KB
/
ci.yml
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
on:
push:
pull_request:
schedule:
# Deploy hourly between 9am and 7pm on weekdays
- cron: "0 9-19 * * 1-5"
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Clone govuk-content-schemas
uses: actions/checkout@v2
with:
repository: alphagov/govuk-content-schemas
ref: deployed-to-production
path: tmp/govuk-content-schemas
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: bundle exec rake
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOVUK_CONTENT_SCHEMAS_PATH: tmp/govuk-content-schemas
deploy:
needs: test
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Set commit message up front
id: commit_message_writer
run: | # `github.event.number` will be blank if this is a cron
if [ "${{ github.event.number }}" == "" ]; then
echo "::set-output name=commit_message::Hourly scheduled redeploy"
else
echo "::set-output name=commit_message::Deploy via merge"
fi
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Clone govuk-content-schemas
uses: actions/checkout@v2
with:
repository: alphagov/govuk-content-schemas
ref: deployed-to-production
path: tmp/govuk-content-schemas
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Build 'build' folder ready for deployment
run: bundle exec rake build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOVUK_CONTENT_SCHEMAS_PATH: tmp/govuk-content-schemas
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
cname: docs.publishing.service.gov.uk
commit_message: ${{steps.commit_message_writer.outputs.commit_message}}
force_orphan: true