Update README.md #2
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: Deploy Website | |
on: | |
push: | |
branches: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
packages: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/atas/ssg-builder:latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
# Restore Composer cache (if exists) | |
- name: Get Composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
# Install Composer dependencies | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress | |
- name: Generate HTML | |
run: | | |
system/bin/generate_html.sh | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: 'html' | |
path: 'html' | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Download artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: 'html' | |
path: './html' | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
# Upload entire repository | |
path: 'html' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |