Publish to GitHub Pages #160
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 to GitHub Pages | |
on: | |
workflow_dispatch: | |
permissions: | |
packages: read | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
build: | |
runs-on: [self-hosted, ubuntu-latest, x64, linux] | |
environment: actions | |
steps: | |
- name: Get OS | |
id: os | |
run: | | |
df -h | |
if [ -n "$(command -v apt-get)" ]; then | |
echo "os=ubuntu" >> "$GITHUB_OUTPUT" | |
echo "Using Ubuntu" | |
else | |
echo "os=linux" >> "$GITHUB_OUTPUT" | |
echo "Using Linux" | |
fi | |
- name: Wait for no dpkg lock | |
shell: bash | |
run: | | |
if [ "${{ steps.os.outputs.os }}" = "ubuntu" ]; then | |
# Check for dpkg lock and wait if necessary | |
while sudo fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1; do | |
echo "Waiting for other software managers to finish..." | |
sleep 5 | |
done | |
fi | |
- uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@verbose | |
with: | |
php-version: '8.2' | |
tools: composer:2.x | |
- name: Composer Install | |
run: composer install | |
- name: Compile Satis pages | |
run: vendor/bin/satis build satis.json ./dist | |
env: | |
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.BOT_TOKEN }}"} }' | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./dist | |
publish: | |
runs-on: [self-hosted, ubuntu-latest, x64, linux] | |
needs: build | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |