Skip to content

Build

Build #817

Workflow file for this run

name: Build
on:
push:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
packages: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
build-image:
runs-on: ubuntu-latest
outputs:
docker-tag: ${{ steps.docker-tag.outputs.docker-tag }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Maybe restore Docker tag
uses: actions/cache@v2
id: cache
with:
path: docker-tag
key: ${{ hashFiles('Dockerfile') }}
- name: Create Docker tag
if: "!steps.cache.outputs.cache-hit"
run: date +'%Y%m%d.${{ github.run_number }}' >docker-tag
- name: Set Docker tag
id: docker-tag
run: echo docker-tag=$(cat docker-tag) >>$GITHUB_OUTPUT
- uses: docker/login-action@v2
if: "!steps.cache.outputs.cache-hit"
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v4
if: "!steps.cache.outputs.cache-hit"
with:
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ steps.docker-tag.outputs.docker-tag }}
build:
runs-on: ubuntu-latest
needs: build-image
container:
image: ghcr.io/${{ github.repository }}:${{ needs.build-image.outputs.docker-tag }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Restore fonts and Poetry cache
id: cache
uses: actions/cache@v2
with:
path: |
fonts
~/.cache/pypoetry
key: ${{ hashFiles('poetry.lock') }}
- name: Get fonts
if: "!steps.cache.outputs.cache-hit"
run: wget -nv -O - ${{ secrets.FONTS_URL }} | tar -xzv
- run: poetry install --only main
- run: poetry run make
env:
PUBLONS_TOKEN: ${{ secrets.PUBLONS_TOKEN }}
FLAGS: --generated=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- uses: actions/upload-pages-artifact@v1
deploy-github:
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- id: deployment
uses: actions/deploy-pages@v1