Skip to content

Publish GitHub pages #22

Publish GitHub pages

Publish GitHub pages #22

Workflow file for this run

run-name: Publish GitHub pages
name: publish-pages
on:
push:
paths: [ "**" ]
pull_request:
env:
IMAGE_REPO: doldecomp/melee
jobs:
# Single deploy job since we're just deploying
gen-pages:
if: false
name: Generate pages
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
OUTPUT: ${{ github.workspace }}/output
steps:
- name: Get image name
env:
IMAGE_SUFFIX: gen-pages:latest
run: |
echo "IMAGE=$IMAGE_REPO/$IMAGE_SUFFIX" >> $GITHUB_ENV
- name: Checkout Melee repository
uses: actions/checkout@v3
- name: Log into container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull generator image
run: docker pull ${{ env.REGISTRY }}/${{ env.IMAGE }}
- name: Generate pages
run: |
mkdir -p "${{ env.OUTPUT }}"
docker run --rm \
--user "$(id -u):$(id -g)" \
--volume "$PWD:/input:ro" \
--volume "${{ env.OUTPUT }}:/output" \
${{ env.REGISTRY }}/${{ env.IMAGE }}
- name: Upload generated pages
uses: actions/upload-artifact@v3
with:
name: pages
path: ${{ env.OUTPUT }}
if-no-files-found: error
deploy-pages:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
needs: gen-pages
if: github.ref_name == github.event.repository.default_branch
concurrency:
group: "pages"
cancel-in-progress: true
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Download generated pages
uses: actions/download-artifact@v3
with:
name: pages
path: /tmp/output
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v1.0.7
with:
path: /tmp/output
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1.2.4