download assets before build #23
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: Publish Blog | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
Build-Publish: | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." | |
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" | |
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Set up python | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
- name: Install Dependencies | |
run: poetry install --no-interaction | |
- name: Set up S3cmd cli tool | |
uses: s3-actions/[email protected] | |
with: | |
provider: aws # default is linode | |
region: 'eu-central-1' | |
access_key: ${{ secrets.S3_ACCESS_KEY }} | |
secret_key: ${{ secrets.S3_SECRET_KEY }} | |
- name: Download Static Assets | |
run: s3cmd sync s3://static.kenpayne.co.uk/ docs/assets/ | |
- name: Build Site | |
run: make html | |
- name: Publish Site | |
run: | | |
s3cmd rm --recursive --force s3://blog.kenpayne.co.uk/ | |
s3cmd put --recursive site/ s3://blog.kenpayne.co.uk/ --acl-public --guess-mime-type --no-mime-magic --add-header='Cache-Control:max-age=0' | |
- run: echo "Done 🚀" |