Skip to content

Update PlantUML

Update PlantUML #3886

name: Update PlantUML
on:
schedule:
- cron: "0 * * * *"
workflow_dispatch:
inputs:
plantuml_version:
description: "Plant UML version"
type: string
jobs:
bump_plantuml:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: plantuml
# using plantuml-server because plantuml for some reason returns empty list of releases
name: PlantUML latest release
run: |
if [[ "${{ inputs.plantuml_version }}" ]]; then echo "tag=${{ inputs.plantuml_version }}"; else echo "tag=$(curl -s https://api.github.com/repos/plantuml/plantuml-server/releases/latest | grep tag_name | sed 's/.*"tag_name": "v\(.*\)",/\1/')"; fi >> $GITHUB_OUTPUT
- name: "Check if tag already exists"
id: tag
run: |
git ls-remote --exit-code origin refs/tags/${{ steps.plantuml.outputs.tag }} && echo "exists=true" || echo "exists=false" >> $GITHUB_OUTPUT
- name: Bump docker version
if: steps.tag.outputs.exists == 'false'
run: |
sed -i "s#holowinski/plantuml:.*#holowinski/plantuml:${{ steps.plantuml.outputs.tag }}\"#" action.yml
- name: Commit PlantUML bump
if: steps.tag.outputs.exists == 'false'
uses: stefanzweifel/git-auto-commit-action@v5
with:
ref: ${{ github.head_ref }}
commit_message: "Bump PlantUML to ${{ steps.plantuml.outputs.tag }}"
- name: Get latest SHA
id: sha
if: steps.tag.outputs.exists == 'false'
run: |
echo "main=$(git rev-parse origin/main)" >> $GITHUB_OUTPUT
- name: Set up QEMU
if: steps.tag.outputs.exists == 'false'
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
if: steps.tag.outputs.exists == 'false'
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: steps.tag.outputs.exists == 'false'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
if: steps.tag.outputs.exists == 'false'
id: docker_build
uses: docker/build-push-action@v6
with:
push: true
tags: holowinski/plantuml:latest, holowinski/plantuml:${{ steps.plantuml.outputs.tag }}
build-args: |
PLANTUML_VERSION=${{ steps.plantuml.outputs.tag }}
- name: Create tag
if: steps.tag.outputs.exists == 'false'
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ steps.plantuml.outputs.tag }}',
sha: '${{ steps.sha.outputs.main }}'
})