0
0
docker-images/.gitea/workflows/etherpad.yaml
Opnxng 16159ef4c4
Some checks failed
docker-buildx / build (push) Failing after 8m41s
ansible / build (push) Successful in 19m37s
etherpad / build (push) Successful in 1m19s
caddy / build (push) Successful in 6m55s
wolfree / build (push) Failing after 4s
simplytranslate / build (push) Failing after 3s
searxng / build-searxng (push) Successful in 1m12s
rat-aint-tieba / build (push) Failing after 5s
proxigram / build (push) Failing after 3s
imgin / build (push) Failing after 5s
binternet / build (push) Failing after 2s
Updated workflows
2024-06-18 12:05:32 +08:00

66 lines
3.0 KiB
YAML

name: etherpad
run-name: etherpad
env:
REPO_NAME: etherpad
REMOTE_REPO: https://github.com/ether/etherpad-lite.git
BUILD_PLATFORM: linux/arm64
on:
schedule:
- cron: "0 0 1 */3 *" # every 3 months
push:
paths:
- ".gitea/workflows/etherpad.yaml"
- "dockerfiles/etherpad.Dockerfile"
jobs:
build:
runs-on: runner
container:
image: git.opnxng.com/opnxng/docker-buildx:latest
steps:
- name: Check latest upstream commit
run: |
STORED_COMMIT=$(curl -H "Authorization: Bearer ${{ secrets.NT }}" -s "https://nt.opnxng.com/${REPO_NAME}/raw?poll=1" | tail -n 1)
LATEST_COMMIT=$(git ls-remote ${REMOTE_REPO} | awk '{print $1}' | head -1)
echo "STORED_COMMIT=${STORED_COMMIT}" >> "$GITHUB_ENV"
echo "LATEST_COMMIT=${LATEST_COMMIT}" >> "$GITHUB_ENV"
echo "Stored Commit: ${STORED_COMMIT}"
echo "Latest Commit: ${LATEST_COMMIT}"
- name: Build and push Docker image
run: |
if [ "$STORED_COMMIT" != "$LATEST_COMMIT" ]; then
echo "Found a new commit, building new image"
# Create and use Docker Buildx builder
docker buildx create --use --name buildx
# Login to Package Registry
echo "${{ secrets.TOKEN }}" | docker login git.opnxng.com -u ${{ gitea.repository_owner }} --password-stdin
# Build and push Docker image
mkdir temp
cd temp
curl -JL https://git.opnxng.com/opnxng/docker-images/raw/branch/main/dockerfiles/etherpad.Dockerfile -o Dockerfile
docker buildx build \
--platform ${BUILD_PLATFORM} \
-t git.opnxng.com/${{ gitea.repository_owner }}/${REPO_NAME}:latest \
-f ./Dockerfile \
--push . && \
curl -H prio:low -d "Built and pushed ${REPO_NAME}" https://ntfy.opnxng.com/build || \
{ curl -H tags:warning -H prio:high -d "Built and pushed ${REPO_NAME} failed!" https://ntfy.opnxng.com/build ; exit 1; }
# Remove Docker Buildx builder
docker buildx rm buildx
else
echo "No new commit, skipped build"
fi
- name: Update stored commit
run: |
if [ "$STORED_COMMIT" != "$LATEST_COMMIT" ]; then
curl -H "Authorization: Bearer ${{ secrets.NT }}" -d $(git ls-remote ${REMOTE_REPO} | awk '{print $1}' | head -1) "https://nt.opnxng.com/${REPO_NAME}"
STORED_COMMIT=$(curl -H "Authorization: Bearer ${{ secrets.NT }}" -s "https://nt.opnxng.com/${REPO_NAME}/raw?poll=1" | tail -n 1)
echo "STORED_COMMIT=${STORED_COMMIT}" >> "$GITHUB_ENV"
else
curl -H "Authorization: Bearer ${{ secrets.NT }}" -d $(git ls-remote ${REMOTE_REPO} | awk '{print $1}' | head -1) "https://nt.opnxng.com/${REPO_NAME}"
STORED_COMMIT=$(curl -H "Authorization: Bearer ${{ secrets.NT }}" -s "https://nt.opnxng.com/${REPO_NAME}/raw?poll=1" | tail -n 1)
echo "STORED_COMMIT=${STORED_COMMIT}" >> "$GITHUB_ENV"
exit 1
fi