fix: Always go to recommended version #19
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/short-sha@v2.2 | |
id: tags | |
with: | |
length: 6 | |
# Docker time! | |
- name: Log in to docker hub | |
uses: docker/login-action@v2.1.0 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Extract metadata for Docker | |
id: meta | |
uses: docker/metadata-action@v4.4.0 | |
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/build-push-action@v4.0.0 | |
with: | |
context: . | |
file: docs/Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |