-
Notifications
You must be signed in to change notification settings - Fork 2
64 lines (60 loc) · 1.89 KB
/
deploy-dev-aws.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
name: Deploy Jekyll site to AWS Dev
on:
push:
branches: ["main"]
workflow_dispatch:
inputs:
invalidate-cache:
description: "Invalidate CloudFront cache"
required: true
type: boolean
default: false
permissions:
contents: read
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: "aws-dev"
cancel-in-progress: false
jobs:
# Build job
deploy:
runs-on: ubuntu-latest
environment:
name: development
url: https://oscalio.dev
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
with:
ruby-version: '3.1'
bundler-cache: true
cache-version: 0
- name: Build with Jekyll
run: bundle exec jekyll build
env:
JEKYLL_ENV: development
- name: Add robots.txt file to disallow all
run: |
echo -e "User-agent: *\nDisallow: /" > _site/robots.txt
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: oscalio-content-dev
path: _site/
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.ROLE_ARN }}
aws-region: ${{ vars.AWS_REGION }}
- name: Copy files to the dev environment
run: |
aws s3 sync . s3://${{ secrets.S3_BUCKET_NAME }}
working-directory: _site
- name: Invalidate CloudFront cache
if: ${{ inputs.invalidate-cache }}
run: |
aws cloudfront create-invalidation --distribution-id ${{ vars.DISTRIBUTION_ID }} --paths "/*"