This repository has been archived by the owner on Nov 16, 2024. It is now read-only.
check, build, deploy carpentries.org #7161
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: check, build, deploy carpentries.org | |
on: | |
push: | |
branches: main | |
schedule: | |
- cron: '30 */6 * * *' | |
workflow_dispatch: | |
jobs: | |
build-website: | |
if: github.repository_owner == 'carpentries' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout the Repository | |
uses: actions/checkout@v2 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '2.7' | |
- name: Install Bundler and YAML linter | |
run: | | |
gem install bundler:2.4.22 yaml-lint | |
- name: Set up caching for Bundler | |
uses: actions/cache@v2 | |
with: | |
path: .vendor/bundle | |
key: gems-${{ hashFiles('**/Gemfile') }} | |
restore-keys: | | |
gems- | |
- name: Install & Update Ruby Gems | |
run: | | |
bundle config path .vendor/bundle | |
bundle install --jobs 4 --retry 3 | |
bundle update | |
- name: Lint _config.yml with yaml-lint | |
run: | | |
yaml-lint _config.yml | |
- name: Lint pages and blog posts | |
run: | | |
yaml-lint -q -n $(find _posts -regex ".*.md\|.*html") &&\ | |
yaml-lint -q -n $(find pages -regex ".*.md\|.*html") | |
- name: Get GeoJSON for instructor map | |
run: | | |
curl --remote-name-all https://feeds.carpentries.org/all_instructors_by_airport.geojson &&\ | |
cp all_instructors_by_airport.geojson files/. | |
- name: Get GeoJSON for member organisations map | |
run: | | |
curl --remote-name-all https://feeds.carpentries.org/all_members_by_location.geojson &&\ | |
cp all_members_by_location.geojson files/. | |
- name: Create PDF file for online teaching recommendations | |
uses: docker://pandoc/latex:latest | |
with: | |
args: > | |
--output files/pdf/online-workshop-recommendations.pdf | |
--pdf-engine=xelatex | |
-V geometry:margin=1in | |
--from=markdown-markdown_in_html_blocks-native_divs | |
pages/online-workshop-recommendations.md | |
- name: Create PDF file for welcome tip sheet | |
uses: docker://pandoc/latex:latest | |
with: | |
args: > | |
--output files/pdf/welcome-tip-sheet.pdf | |
--pdf-engine=xelatex | |
-V geometry:margin=1in | |
--from=markdown-markdown_in_html_blocks-native_divs | |
pages/welcome-tip-sheet.md | |
- name: Build site | |
run: make site | |
- name: Deploy to AWS S3 | |
id: deploy | |
uses: fmichonneau/s3-sync-action@log-output | |
with: | |
args: --acl public-read --follow-symlinks --delete | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
SOURCE_DIR: _site/ | |
- name: Invalidate CloudFront | |
uses: chetan/invalidate-cloudfront-action@master | |
env: | |
PATHS: /* | |
AWS_REGION: 'us-east-1' | |
DISTRIBUTION: ${{ secrets.DISTRIBUTION }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |