Time Zones Are Hard - https://tz.rita.moe

Use same build script than atw-watcher

[skip ci]

Changed files
+44 -13
.forgejo
workflows
+44 -13
.forgejo/workflows/build.yml
···
branches:
- main
+
pull_request:
+
branches: [ "**" ]
+
+
env:
+
SHA: ${{ github.event.pull_request.head.sha || github.event.after }}
+
COMPARE_TAG: latest
+
jobs:
build:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
···
name: Build
container:
image: catthehacker/ubuntu:act-latest
-
env:
-
DOCKER_TAG: latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get Meta
-
id: meta
+
id: repometa
run: |
echo REGISTRY_DOMAIN=$(echo ${GITHUB_SERVER_URL} | sed 's\^https://\\') >> $GITHUB_OUTPUT
-
echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
- name: Set up QEMU
-
uses: docker/setup-qemu-action@v2
+
uses: https://github.com/docker/setup-qemu-action@v2
- name: Set up Docker BuildX
-
uses: docker/setup-buildx-action@v2
+
uses: https://github.com/docker/setup-buildx-action@v2
- name: Login to registry
-
uses: docker/login-action@v2
+
uses: https://github.com/docker/login-action@v2
with:
-
registry: ${{ steps.meta.outputs.REGISTRY_DOMAIN }}
+
registry: ${{ steps.repometa.outputs.REGISTRY_DOMAIN }}
username: ${{ github.repository_owner }}
password: ${{ secrets.CI_REGISTRY_TOKEN }}
+
- name: Docker metadata
+
id: meta
+
uses: https://github.com/docker/metadata-action@v4
+
with:
+
images: ${{ steps.repometa.outputs.REGISTRY_DOMAIN }}/${{ github.repository }}
+
labels: |
+
org.opencontainers.image.revision=${{ env.SHA }}
+
tags: |
+
type=edge,branch=$repo.default_branch
+
type=sha,prefix=,suffix=,format=short
+
type=raw,value=latest,enable={{is_default_branch}}
+
- name: Build and push
-
uses: docker/build-push-action@v4
+
uses: https://github.com/docker/build-push-action@v4
env:
ACTIONS_RUNTIME_TOKEN: '' # See https://gitea.com/gitea/act_runner/issues/119
with:
···
platforms: |
linux/amd64
linux/arm64
-
push: true
-
tags: |
-
${{ steps.meta.outputs.REGISTRY_DOMAIN }}/${{ github.repository }}:${{ steps.meta.outputs.REPO_VERSION }}
-
${{ steps.meta.outputs.REGISTRY_DOMAIN }}/${{ github.repository }}:${{ env.DOCKER_TAG }}
+
push: ${{ github.event_name != 'pull_request' }}
+
tags: ${{ steps.meta.outputs.tags }}
+
labels: ${{ steps.meta.outputs.labels }}
+
cache-from: type=gha
+
cache-to: type=gha,mode=max
+
+
# - name: Docker Scout
+
# id: docker-scout
+
# if: ${{ github.event_name == 'pull_request' }}
+
# uses: https://github.com/docker/scout-action@v0.23.4
+
# with:
+
# dockerhub-user: ${{ secrets.DOCKERHUB_USER }}
+
# dockerhub-password: ${{ secrets.DOCKERHUB_PASSWORD }}
+
# command: compare
+
# # image: ${{ steps.meta.outputs.tags }}
+
# to: ${{ steps.repometa.outputs.REGISTRY_DOMAIN }}/${{ github.repository }}:${{ env.COMPARE_TAG }}
+
# ignore-unchanged: true
+
# write-comment: true
+
# github-token: ${{ secrets.GITHUB_TOKEN }} # to be able to write the comment