Update push.yml #41
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: PushAction | |
on: | |
push: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
process-push: | |
runs-on: self-hosted | |
steps: | |
- name: Cancel previous runs | |
uses: n1hility/cancel-previous-runs@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Fetch git repository | |
uses: actions/checkout@v2 | |
with: | |
path: website | |
- name: Initialise environment | |
run: cat "$GITHUB_WORKSPACE/website/.github-env-${GITHUB_REF##*/}" >> $GITHUB_ENV | |
- run: env | |
- name: Directory push/pop | |
uses: linaro-its/[email protected] | |
with: | |
cacheDirectory: /srv/site-builds | |
namedDirectory: ${{ env.SITE_URL }} | |
destinationDirectory: ${{ github.workspace }}/website | |
- name: Build site | |
run: /srv/github-action-scripts/build-jekyll-site.sh | |
env: | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check links | |
run: /srv/github-action-scripts/check-links.sh ${{ github.workspace }}/website/${{ env.SITE_URL }} | |
- name: Check routing rules | |
run: /srv/github-action-scripts/test-routing-rules.sh | |
- name: Make staging directory | |
run: mkdir -p /srv/s3-staging/${{ env.SITE_URL }} | |
- name: Sync build to staging directory | |
run: rsync -crui ${{ github.workspace }}/website/${{ env.SITE_URL }}/ /srv/s3-staging/${{ env.SITE_URL }} --delete | |
- name: Upload to S3 | |
run: /srv/github-action-scripts/upload-to-s3-root.sh | |
- name: Set up Lambda redirect | |
run: /srv/github-action-scripts/set-up-lambda-redirect.sh ${{ github.workspace }}/website | |
- name: Set up security headers | |
run: cd /srv/github-action-scripts && pipenv run python lambda-security-headers.py | |
- name: Invalidate CloudFront cache | |
run: /srv/github-action-scripts/invalidate-cloudfront.sh |