-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (51 loc) · 1.94 KB
/
preview-untp-core-pages.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
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# Sample workflow for building and deploying a Jekyll site to AWS S3
name: preview (untp-coreorec-pages)
on:
push:
branches:
- untp-core-pages
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "untp-core-pages"
cancel-in-progress: true
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: 'us-west-1'
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.6.5" # Not needed with a .ruby-version file
- id: set-env
name: output a major_version for the release
run: |
major_version=$(cat _config_preview.yml | yq e '.versions.untp-core' | cut -d. -f1)
echo "major_version=$major_version" >> "$GITHUB_OUTPUT"
- name: Print the major_version
run: |
echo "the major_version is ${{ steps.set-env.outputs.major_version }}"
- name: "Bundle install"
run: bundle install
- name: "Build Site"
run: |
yq -i '.baseurl="/vocabulary/untp/core/${{ steps.set-env.outputs.major_version }}"' _config_preview.yml
bundle exec jekyll build --config _config_preview.yml
- name: "Deploy to AWS S3"
run: |
aws s3 sync ./_site/ s3://uncefact-vocab-preview-sam-bucket-private/vocabulary/untp/core/${{ steps.set-env.outputs.major_version }} --cache-control max-age=604800
aws cloudfront create-invalidation --distribution-id "E32QP2QS6SXRHC" --paths "/vocabulary/untp/core/${{ steps.set-env.outputs.major_version }}/*"