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

124 lines
3.9 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:
2024-12-02 17:54:57 +00:00
- cron: '15 10 * * *'
2024-11-16 07:58:35 +00:00
workflow_dispatch:
inputs:
rebuild:
description: 'rebuild'
type: boolean
required: true
2024-11-13 15:59:36 +00:00
env:
2024-11-24 08:09:21 +00:00
DOTCLEAR_IMAGE: 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-24 08:09:21 +00:00
DOCKER_NAMESPACE: jcpd
2024-11-13 15:59:36 +00:00
jobs:
2024-11-16 07:58:35 +00:00
check_release:
2024-11-16 08:13:02 +00:00
name: Check and compare official Dotclear version
2024-11-16 07:58:35 +00:00
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
version: ${{ steps.dotclear.outputs.version }}
2024-11-30 10:56:11 +00:00
exists: ${{ steps.repository.outputs.exists }}
2024-11-16 07:58:35 +00:00
steps:
- name: Download and parse last version
id: dotclear
run: |
2024-12-02 22:49:55 +00:00
curl -sSL https://bit.ly/install-xq | sudo bash
2024-11-16 07:58:35 +00:00
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 repository releases
id: repository
2024-11-30 10:56:11 +00:00
uses: mukunku/tag-exists-action@v1.6.0
with:
tag: ${{ steps.dotclear.outputs.version }}
2024-11-16 07:58:35 +00:00
do_release:
2024-12-02 22:49:55 +00:00
needs: check_release
if: (needs.check_release.outputs.exists == 'false')
2024-11-16 08:13:02 +00:00
name: Create repository release according to Dotclear version
2024-11-16 07:58:35 +00:00
runs-on: ubuntu-latest
permissions:
contents: write
steps:
2024-11-28 17:23:34 +00:00
- name: Check out the repo
uses: actions/checkout@v4
2024-12-02 17:54:57 +00:00
2024-11-16 07:58:35 +00:00
- name: Create repository release
id: create_release
2024-11-30 11:02:44 +00:00
uses: softprops/action-gh-release@v2
2024-11-16 07:58:35 +00:00
with:
2024-11-30 11:02:44 +00:00
name: ${{ needs.check_release.outputs.version }}
2024-11-30 10:48:41 +00:00
tag_name: ${{ needs.check_release.outputs.version }}
2024-12-02 22:49:55 +00:00
body: Source for docker image of Dotclear ${{ needs.check_release.outputs.version }} stable
2024-11-30 10:48:41 +00:00
draft: false
2024-11-16 07:58:35 +00:00
prerelease: false
do_image:
2024-12-02 22:49:55 +00:00
needs: check_release
if: ((needs.check_release.outputs.exists == 'false') || (github.event.inputs.rebuild == 'true'))
2024-11-24 08:09:21 +00:00
name: Build and push latest and versionned images
2024-11-13 15:59:36 +00:00
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
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-24 08:09:21 +00:00
- name: Log in to Github registry
2024-11-24 08:25:08 +00:00
uses: docker/login-action@v3
2024-11-24 08:09:21 +00:00
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: set lower case github repository
run: |
echo "GITHUB_REPOSITORY=${REPO,,}" >>${GITHUB_ENV}
env:
REPO: '${{ github.repository }}'
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-24 08:09:21 +00:00
${{ env.DOCKER_NAMESPACE }}/${{ env.DOTCLEAR_IMAGE }}:${{ needs.check_release.outputs.version }}
${{ env.DOCKER_NAMESPACE }}/${{ env.DOTCLEAR_IMAGE }}:latest
ghcr.io/${{ env.GITHUB_REPOSITORY }}:${{ needs.check_release.outputs.version }}
ghcr.io/${{ env.GITHUB_REPOSITORY }}:latest
2024-11-13 15:59:36 +00:00
build-args: CANAL=${{ env.DOTCLEAR_CANAL }}
2024-11-24 08:47:32 +00:00
platforms: linux/386,linux/amd64,linux/arm64,linux/arm/V7
cache-from: type=gha
cache-to: type=gha,mode=max
2024-11-16 12:38:33 +00:00
- name: Send Telegram Message Ok
uses: appleboy/telegram-action@master
env:
GITHUB_CONTEXT: ${{toJSON(github)}}
with:
to: ${{ secrets.TELEGRAM_ID }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message: Images __${{ env.DOTCLEAR_IMAGE }}:latest__ and __${{ env.DOTCLEAR_IMAGE }}:${{ needs.check_release.outputs.version }}__ successfully generated.