docker-dotclear/.github/workflows/release_stable.yml

96 lines
2.7 KiB
YAML
Raw Normal View History

2024-11-16 07:58:35 +00:00
name: Build and push stable image
2024-11-13 15:59:36 +00:00
on:
2024-11-16 07:58:35 +00:00
schedule:
- cron: '0 10 * * *'
workflow_dispatch:
inputs:
rebuild:
description: 'rebuild'
type: boolean
required: true
2024-11-13 15:59:36 +00:00
env:
2024-11-16 07:58:35 +00:00
DOTCLEAR_IMAGE: jcpd/docker-dotclear
2024-11-13 17:00:56 +00:00
DOTCLEAR_CANAL: stable
2024-11-16 07:58:35 +00:00
DOTCLEAR_URL: https://download.dotclear.org/versions.xml
2024-11-13 15:59:36 +00:00
jobs:
2024-11-16 07:58:35 +00:00
check_release:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
version: ${{ steps.dotclear.outputs.version }}
exists: ${{ steps.repository.outputs.release-exists }}
steps:
- name: Install required packages
run: curl -sSL https://bit.ly/install-xq | sudo bash
- name: Download and parse last version
id: dotclear
run: |
curl -fsSL -o versions.xml ${{ env.DOTCLEAR_URL }}
echo version=$(cat versions.xml | xq -x "//release[@name='${{ env.DOTCLEAR_CANAL }}']/@version") >> $GITHUB_OUTPUT
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check repository releases
id: repository
uses: insightsengineering/release-existence-action@v1.0.0
with:
release-tag: ${{ steps.dotclear.outputs.version }}
do_release:
runs-on: ubuntu-latest
permissions:
contents: write
needs: check_release
if: needs.check_release.outputs.exists == 'false'
steps:
- name: Create repository release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.check_release.outputs.version }}
name: ${{ needs.check_release.outputs.version }}
draft: false
prerelease: false
do_image:
2024-11-13 15:59:36 +00:00
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
2024-11-16 07:58:35 +00:00
needs: check_release
if: (needs.check_release.outputs.exists == 'false') || (github.event.inputs.rebuild == 'true')
2024-11-13 15:59:36 +00:00
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
2024-11-13 17:00:56 +00:00
- name: Build and push images
2024-11-13 15:59:36 +00:00
uses: docker/build-push-action@v6
with:
context: .
sbom: true
push: true
2024-11-13 17:00:56 +00:00
tags: |
2024-11-16 07:58:35 +00:00
${{ env.DOTCLEAR_IMAGE }}:${{ needs.check_release.outputs.version }}
${{ env.DOTCLEAR_IMAGE }}:latest
2024-11-13 15:59:36 +00:00
build-args: CANAL=${{ env.DOTCLEAR_CANAL }}
platforms: linux/386,linux/amd64,linux/arm/V6