fix: Forgor #18
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: Build docs | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
# Checkout the repo files | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Build docs | |
run: ./gradlew docs:assemble | |
- name: Grab gradle version | |
run: | | |
echo "VERSION_NAME=$(${{github.workspace}}/gradlew -q ciVersion)" >> $GITHUB_OUTPUT | |
id: version | |
- name: Generate short sha | |
uses: benjlevesque/[email protected] | |
id: tags | |
with: | |
length: 6 | |
# Docker time! | |
- name: Log in to docker hub | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Extract metadata for Docker | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: lichthund/docs | |
tags: | | |
type=semver,pattern={{version}},value=${{steps.version.outputs.VERSION_NAME}}-${{ steps.tags.outputs.sha }} | |
flavor: | | |
latest=true | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push Docker image | |
uses: docker/[email protected] | |
with: | |
context: . | |
file: docs/Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |