-
-
Notifications
You must be signed in to change notification settings - Fork 77
59 lines (55 loc) · 1.78 KB
/
deploy.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
name: Deploy
on:
push:
branches: [master]
workflow_dispatch:
inputs:
ref:
description: 'Branch, tag or commit SHA1 to build'
required: true
type: string
default: master
## cancel ongoing runs if the workflow is triggered
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
name: Build and Deploy
runs-on: ubuntu-latest
if: github.repository_owner == 'crystal-lang'
env:
O: _site
COMPOSE_FILE: "docker-compose.yml:docker-compose.ci.yml"
GIT_REF: "${{ (github.event_name == 'workflow_dispatch' && inputs.ref) || github.ref }}"
steps:
- name: Checkout ${{ env.GIT_REF }}
uses: actions/checkout@v3
with:
ref: ${{ env.GIT_REF }}
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cache/bundle
tmp/.htmlproofer
key: gem-${{ hashFiles('Gemfile.lock') }}
restore-keys: gem-
- name: Build website
run: |
docker compose run --rm web /bin/bash -c "bundle check || bundle install --jobs=3"
docker compose run -e O --rm web make build
sudo chown -R $(whoami):$(whoami) $O
- name: Fetch install.sh
run: |
make $O/install.sh
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Sync to S3
run: |
aws s3 sync ./$O s3://crystal-website --delete
./scripts/set-legacy-url-redirects.bash crystal-website < ./_data/legacy_non_pretty_urls.txt