Build and Deploy #34
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: Build and Deploy | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Lint Quarto Notebooks | |
run: | | |
find ./project/docs/ -name "*.qmd" -type f -exec python meta/testing/linter.py {} \; > lint_output.txt | |
if [ -s lint_output.txt ]; then | |
echo "linting_failed=true" >> $GITHUB_OUTPUT | |
cat lint_output.txt | |
fi | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and export | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./meta/building/.dockerfile | |
tags: my-app-image:latest | |
outputs: type=local,dest=./artifacts | |
# - name: Test Build | |
# run: mkdir -p artifacts && touch artifacts/test.txt | |
- name: Display structure of downloaded files | |
run: ls -R ./artifacts | |
- name: Upload files as artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: site | |
path: artifacts | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: site | |
path: artifacts | |
- name: Print directory structure | |
run: | | |
echo "Contents of artifacts directory:" | |
tree | |
ls -al artifacts | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: artifacts | |
publish_branch: gh-pages | |
- name: Remove HTML files | |
run: | | |
find artifacts -name '*.html' -exec rm {} \; | |
- name: Deploy remaining artifacts | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: artifacts | |
publish_branch: artifacts |