Fix Joannis' profile #6
Workflow file for this run
This file contains hidden or 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 with Toucan | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| - '[0-9]*' | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build-page: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Validate required secrets | |
| run: | | |
| if [ -z "${{ secrets.SWIFTINIT_ACCOUNT }}" ]; then | |
| echo "❌ Missing secret: SWIFTINIT_ACCOUNT" | |
| exit 1 | |
| fi | |
| if [ -z "${{ secrets.SWIFTINIT_API_KEY }}" ]; then | |
| echo "❌ Missing secret: SWIFTINIT_API_KEY" | |
| exit 1 | |
| fi | |
| if [ -z "${{ secrets.SWIFTINIT_TARGET }}" ]; then | |
| echo "❌ Missing secret: SWIFTINIT_TARGET" | |
| exit 1 | |
| fi | |
| echo "✅ All required secrets are present." | |
| - name: Prepare cache and output directories | |
| run: | | |
| mkdir -p ./cache | |
| chmod -R 777 ./cache | |
| mkdir -p ./dist | |
| chmod -R 777 ./dist | |
| - name: Run Toucan container and build site | |
| run: | | |
| docker create \ | |
| --mount type=bind,source=${{ github.workspace }},target=/site \ | |
| --mount type=bind,source=${{ github.workspace }}/cache,target=/site/cache \ | |
| -w /site \ | |
| -e SWIFTINIT_ACCOUNT=${{ secrets.SWIFTINIT_ACCOUNT }} \ | |
| -e SWIFTINIT_API_KEY=${{ secrets.SWIFTINIT_API_KEY }} \ | |
| -e SWIFTINIT_TARGET=${{ secrets.SWIFTINIT_TARGET }} \ | |
| --name toucan-build \ | |
| toucansites/toucan:latest generate \ | |
| . \ | |
| --target live | |
| docker start --attach toucan-build | |
| - name: Copy generated site from container to host | |
| run: | | |
| docker cp toucan-build:/tmp/output/. ./dist | |
| docker rm toucan-build | |
| - name: Upload static site to GitHub Pages | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./dist | |
| deploy-page: | |
| needs: build-page | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |