Skip to content

article to education #169

article to education

article to education #169

Workflow file for this run

name: deploy_dev_website
env:
PUBLISHER_ROLE_ARN: "${{ secrets.DEV_PUBLISHER_ROLE_ARN }}"
AWS_REGION: "us-east-2"
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: ["development"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
id-token: write # Used to get an access token, which is then used to assume an AWS IAM role
contents: read
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "deploy_website"
deploy_website:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Global environment
#env:
# ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
# JEKYLL_ENV: production
permissions:
id-token: write
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Setup the system with the repository code, Java, and Ruby
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
distribution: 'temurin'
# s3_website ruby/java uploader does not support 11. :-(
java-version: '8'
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
ruby-version: '2.7.5'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ env.PUBLISHER_ROLE_ARN }}
role-session-name: site_publisher_session
aws-region: ${{ env.AWS_REGION }}
# Run the deployment
- name: Deploy website
run: |
bundle exec jekyll build || true
bundle exec jekyll build --trace
bundle exec s3_website push --config-dir deploy/dev
# Let the astro workflow do the cloudfront work
#CLOUDFRONT_FUNCTION_ETAG=$(aws cloudfront describe-function --name fusionauth-website-request-handler --query 'ETag' --output text)
#CLOUDFRONT_FUNCTION_ETAG=$(aws cloudfront update-function --name fusionauth-website-request-handler --function-code fileb://src/cloudfront/fusionauth-website-request-handler.js --function-config Comment="Request handler for the FusionAuth website",Runtime="cloudfront-js-1.0" --if-match ${CLOUDFRONT_FUNCTION_ETAG} --query 'ETag' --output text)
#aws cloudfront publish-function --name fusionauth-website-request-handler --if-match ${CLOUDFRONT_FUNCTION_ETAG}
shell: bash
# Update the Algolia search index if this is `master`
- name: Update search index
if: startsWith(github.ref, 'refs/heads/master')
run: |
bundle exec jekyll algolia
shell: bash