Skip to content

Change order of items in facilitate submenu #593

Change order of items in facilitate submenu

Change order of items in facilitate submenu #593

name: "Website Deploy"
on:
push:
branches: ['master', 'release']
jobs:
jekyll:
name: "Jekyll"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: build docker image for building jekyll site
run: docker build . -t local/p2pu-website
- name: setup staging config
shell: bash
run: |
echo "S3_BUCKET=p2pu-staging" >> $GITHUB_ENV
echo "CLOUDFRONT_DISTRIBUTION_ID=$CLOUDFRONT_DISTRIBUTION_ID" >> $GITHUB_ENV
echo "mapbox_access_token: $MAPBOX_ACCESS_TOKEN" > ./_production.yml
echo "url: https://www-staging.p2pu.org" >> ./_production.yml
echo "api_origin: https://staging-learningcircles.p2pu.org" >> ./_production.yml
if: github.ref == 'refs/heads/master'
env:
MAPBOX_ACCESS_TOKEN: ${{secrets.MAPBOX_ACCESS_TOKEN}}
CLOUDFRONT_DISTRIBUTION_ID: ${{secrets.CLOUDFRONT_DISTRIBUTION_ID_STAGING}}
- name: setup production config
shell: bash
run: |
echo "S3_BUCKET=p2pu-website" >> $GITHUB_ENV
echo "CLOUDFRONT_DISTRIBUTION_ID=$CLOUDFRONT_DISTRIBUTION_ID" >> $GITHUB_ENV
echo "mapbox_access_token: $MAPBOX_ACCESS_TOKEN" > ./_production.yml
echo "api_origin: https://learningcircles.p2pu.org" >> ./_production.yml
if: github.ref == 'refs/heads/release'
env:
MAPBOX_ACCESS_TOKEN: ${{secrets.MAPBOX_ACCESS_TOKEN}}
CLOUDFRONT_DISTRIBUTION_ID: ${{secrets.CLOUDFRONT_DISTRIBUTION_ID}}
- run: echo $S3_BUCKET
- name: get live data for teams
run: curl https://learningcircles.p2pu.org/api/teams/ -o ./_data/teams.json
- name: process live data for teams
run: cat ./_data/teams.json | python3 _deploy/team_pages.py
- name: build frontend
run: docker run --rm --volume `pwd`:/opt/app --workdir /opt/app node:20 /bin/sh -c "npm install && npm run build"
- name: build jekyll site
run: docker run -v `pwd`:/opt/app -v `pwd`/_site:/opt/app/_site local/p2pu-website bundle exec jekyll build --future --config _config.yml,_production.yml
- name: create docker network for testing
run: docker network create test-net
- name: test setup
run: docker run --name site --workdir /tmp -d --network test-net --publish 3000:3000 --volume `pwd`/_site:/var/www node:20 /bin/sh -c "npm i serve && npx serve -l 3000 /var/www"
- name: build docker image for testing with puppeteer
run: docker build ./docker/puppeteer/ -t local/puppeteer
- name: run test
run: docker run --rm --network test-net --volume `pwd`:/opt/app --workdir /opt/app -e TEST_SERVER_URL=http://site:3000 local/puppeteer /bin/sh -c "npm install --legacy-peer-deps && npm run test"
- run: 'aws s3 sync ./_site/ s3://$S3_BUCKET/ --delete --storage-class REDUCED_REDUNDANCY --acl public-read'
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_EC2_METADATA_DISABLED: true
- run: ./_deploy/s3_redirects.sh
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_EC2_METADATA_DISABLED: true
- run: aws s3api put-bucket-website --bucket $S3_BUCKET --website-configuration file://_deploy/s3_website_config.json
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_PAGER: ""
AWS_EC2_METADATA_DISABLED: true
- run: aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_PAGER: ""
AWS_EC2_METADATA_DISABLED: true