2024-02-25 00:04:36 +02:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
schedule:
|
2024-02-25 11:47:58 +02:00
|
|
|
- cron: "0 0 * * *"
|
2024-02-24 13:11:53 +02:00
|
|
|
jobs:
|
|
|
|
build_image:
|
2024-02-25 00:06:40 +02:00
|
|
|
name: Build image
|
2024-02-25 00:04:36 +02:00
|
|
|
env:
|
2024-02-25 00:24:46 +02:00
|
|
|
FORGEJO_VERSION: 1.21
|
2024-02-25 00:04:36 +02:00
|
|
|
SCHEDULED: ${{ github.event_name == 'schedule' }}
|
2024-02-25 11:47:58 +02:00
|
|
|
PUSHED: ${{ github.event_name == 'push' }}
|
2024-02-25 00:04:36 +02:00
|
|
|
REGISTRY: git.korhonen.cc
|
|
|
|
REPO: ${{ env.REGISTRY }}/functionalhacker/forgejo-asciidoc
|
2024-02-24 13:11:53 +02:00
|
|
|
runs-on: docker
|
|
|
|
steps:
|
2024-02-25 00:04:36 +02:00
|
|
|
- name: Check if update available
|
2024-02-26 10:33:24 +02:00
|
|
|
if: env.SCHEDULED == 'true'
|
2024-02-25 00:04:36 +02:00
|
|
|
id: check
|
2024-02-25 00:33:07 +02:00
|
|
|
uses: https://github.com/ClementTsang/docker-check-base-image-diff@v0.0.2
|
2024-02-25 00:04:36 +02:00
|
|
|
with:
|
2024-02-25 10:58:02 +02:00
|
|
|
base-image: docker://codeberg.org/forgejo/forgejo:${{ env.FORGEJO_VERSION }}
|
|
|
|
derived-image: docker://${{ env.REPO }}:latest
|
2024-02-25 00:04:36 +02:00
|
|
|
- name: Check result
|
2024-02-26 10:33:24 +02:00
|
|
|
if: env.SCHEDULED == 'true'
|
2024-02-25 00:33:07 +02:00
|
|
|
run: echo "Needs updating = ${{ steps.check.outputs.differs }}"
|
2024-02-24 13:20:09 +02:00
|
|
|
- name: Set up Docker Buildx
|
2024-02-26 10:33:24 +02:00
|
|
|
if: env.PUSHED == 'true' || steps.check.outputs.differs == 'true'
|
2024-02-24 13:20:09 +02:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2024-02-25 00:04:36 +02:00
|
|
|
- name: Login to Docker registry
|
2024-02-26 10:33:24 +02:00
|
|
|
if: env.PUSHED == 'true' || steps.check.outputs.differs == 'true'
|
2024-02-24 13:11:53 +02:00
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
2024-02-25 00:04:36 +02:00
|
|
|
registry: ${{ env.REGISTRY }}
|
2024-02-24 13:11:53 +02:00
|
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
2024-02-28 12:26:45 +02:00
|
|
|
- name: Get point release
|
2024-02-28 12:41:34 +02:00
|
|
|
id: point_release
|
2024-02-28 12:26:45 +02:00
|
|
|
if: env.PUSHED == 'true' || steps.check.outputs.differs == 'true'
|
2024-02-28 12:37:36 +02:00
|
|
|
run: |
|
|
|
|
echo "POINT_RELEASE=$(skopeo inspect docker://codeberg.org/forgejo/forgejo:${{ FORGEJO_VERSION }} | jq -r '.RepoTags | last' | cut -d '-' -f 1)" >> $GITHUB_ENV
|
2024-02-28 12:41:34 +02:00
|
|
|
echo "point_release=$POINT_RELEASE" >> $GITHUB_OUTPUT
|
2024-02-24 13:21:12 +02:00
|
|
|
- name: Build and push image
|
2024-02-26 10:33:24 +02:00
|
|
|
if: env.PUSHED == 'true' || steps.check.outputs.differs == 'true'
|
2024-02-24 13:21:12 +02:00
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
with:
|
|
|
|
push: true
|
2024-02-25 00:04:36 +02:00
|
|
|
build-args: FORGEJO_VERSION=${{ env.FORGEJO_VERSION }}
|
|
|
|
tags: |
|
|
|
|
${{ env.REPO }}:latest
|
|
|
|
${{ env.REPO }}:${{ env.FORGEJO_VERSION }}
|
2024-02-28 12:41:34 +02:00
|
|
|
${{ env.REPO }}:${{ steps.point_release.outputs.point_release }}
|
2024-02-24 15:57:23 +02:00
|
|
|
- name: Notify in Telegram channel
|
2024-02-26 10:33:24 +02:00
|
|
|
if: env.PUSHED == 'true' || steps.check.outputs.differs == 'true'
|
2024-02-24 15:58:32 +02:00
|
|
|
uses: https://github.com/appleboy/telegram-action@master
|
2024-02-24 15:57:23 +02:00
|
|
|
with:
|
|
|
|
to: "-1001915202306"
|
|
|
|
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
|
|
message: |
|
2024-02-28 12:41:34 +02:00
|
|
|
forgejo-asciidoc v${{ steps.point_release.outputs.point_release }} has just been built. docker pull away!
|
2024-02-24 15:57:23 +02:00
|
|
|
|
2024-02-24 16:00:37 +02:00
|
|
|
See details: https://git.korhonen.cc/FunctionalHacker/-/packages/container/forgejo-asciidoc/latest
|