This commit is contained in:
parent
2c0fe2c863
commit
741425624c
@ -15,11 +15,8 @@ jobs:
|
||||
build:
|
||||
runs-on: runner
|
||||
container:
|
||||
image: docker:cli
|
||||
image: git.opnxng.com/opnxng/docker-buildx:latest
|
||||
steps:
|
||||
- name: Install packages
|
||||
run: apk --no-cache add curl git jq
|
||||
|
||||
- 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)
|
||||
@ -33,19 +30,15 @@ jobs:
|
||||
run: |
|
||||
if [ "$STORED_COMMIT" != "$LATEST_COMMIT" ]; then
|
||||
echo "Found a new commit, building new image"
|
||||
# Install Docker Buildx
|
||||
BUILDX_VERSION=$(wget -q -O- https://api.github.com/repos/docker/buildx/releases/latest | jq -r '.name')
|
||||
wget -O /usr/bin/docker-buildx https://github.com/docker/buildx/releases/download/$BUILDX_VERSION/buildx-$BUILDX_VERSION.linux-arm64
|
||||
chmod +x /usr/bin/docker-buildx
|
||||
# Create and use Docker Buildx builder
|
||||
docker-buildx create --use --name buildx
|
||||
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
|
||||
git clone ${REMOTE_REPO} .
|
||||
docker-buildx build \
|
||||
docker buildx build \
|
||||
--platform ${BUILD_PLATFORM} \
|
||||
-t git.opnxng.com/${{ gitea.repository_owner }}/${REPO_NAME}:latest \
|
||||
-f ./Dockerfile \
|
||||
@ -53,7 +46,7 @@ jobs:
|
||||
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
|
||||
docker buildx rm buildx
|
||||
else
|
||||
echo "No new commit, skipped build"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user