forgejo-asciidoc/.forgejo/workflows/build.yaml

63 lines
2.5 KiB
YAML
Raw Normal View History

on:
push:
schedule:
2024-02-25 11:47:58 +02:00
- cron: "0 0 * * *"
jobs:
build_image:
2024-02-25 00:06:40 +02:00
name: Build image
env:
FORGEJO_VERSION: 1.21
SCHEDULED: ${{ github.event_name == 'schedule' }}
2024-02-25 11:47:58 +02:00
PUSHED: ${{ github.event_name == 'push' }}
REGISTRY: git.korhonen.cc
REPO: ${{ env.REGISTRY }}/functionalhacker/forgejo-asciidoc
runs-on: docker
steps:
- name: Check if update available
2024-02-26 10:33:24 +02:00
if: env.SCHEDULED == 'true'
id: check
uses: https://github.com/ClementTsang/docker-check-base-image-diff@v0.0.2
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
- name: Check result
2024-02-26 10:33:24 +02:00
if: env.SCHEDULED == 'true'
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
- name: Login to Docker registry
2024-02-26 10:33:24 +02:00
if: env.PUSHED == 'true' || steps.check.outputs.differs == 'true'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
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: |
2024-02-28 17:48:49 +02:00
VERSION="$(skopeo list-tags docker://codeberg.org/forgejo/forgejo | jq -r '.Tags | last' | cut -d '-' -f 1)"
2024-02-28 17:43:50 +02:00
echo "Point release: $VERSION"
echo "version=$VERSION" >> $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
build-args: FORGEJO_VERSION=${{ env.FORGEJO_VERSION }}
tags: |
${{ env.REPO }}:latest
${{ env.REPO }}:${{ env.FORGEJO_VERSION }}
2024-02-28 17:43:50 +02:00
${{ env.REPO }}:${{ steps.point_release.outputs.version }}
- 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
with:
to: "-1001915202306"
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
2024-02-28 17:43:50 +02:00
forgejo-asciidoc v${{ steps.point_release.outputs.version }} has just been built. docker pull away!
2024-02-24 16:00:37 +02:00
See details: https://git.korhonen.cc/FunctionalHacker/-/packages/container/forgejo-asciidoc/latest