feat(ci/cd): Add image based on stable tag
This commit is contained in:
parent
7fdf7d0f5c
commit
7251cf6bf3
3 changed files with 141 additions and 6 deletions
|
@ -8,7 +8,7 @@ on:
|
|||
- 'manual_build'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build-latest:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Extract Version Tag
|
62
.gitea/workflows/build_stable.yml
Normal file
62
.gitea/workflows/build_stable.yml
Normal file
|
@ -0,0 +1,62 @@
|
|||
name: Build
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * 1"
|
||||
push:
|
||||
tags:
|
||||
- 'manual_build'
|
||||
|
||||
jobs:
|
||||
build-stable:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Extract Version Tag
|
||||
id: extract-version
|
||||
run: |
|
||||
export DIGEST=$(curl -s "https://registry.hub.docker.com/v2/repositories/library/nextcloud/tags/?page_size=100" | jq -r '.results[] | select(.name=="stable") .digest')
|
||||
export VERSION=$(curl -s "https://registry.hub.docker.com/v2/repositories/library/nextcloud/tags/?page_size=1000" | jq -r ".results[] | select(.name | test(\"^([0-9]+\\\.)+[0-9]+$\")) | select(.digest==\"$DIGEST\").name")
|
||||
export VERSION_MAJOR=$(curl -s "https://registry.hub.docker.com/v2/repositories/library/nextcloud/tags/?page_size=1000" | jq -r ".results[] | select(.name | test(\"^[0-9]{1,2}$\")) | select(.digest==\"$DIGEST\").name")
|
||||
echo "Latest version: $VERSION"
|
||||
echo "Major version: $VERSION_MAJOR"
|
||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||
echo "version-major=${VERSION_MAJOR}" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
- name: Check if the image was already built
|
||||
id: check-build-status
|
||||
run: |
|
||||
if curl --silent -f -lSL "https://hub.docker.com/v2/repositories/jiriks74/nextcloud-extended/tags/$(echo ${{steps.extract-version.outputs.version}})" 2> /dev/null; then echo "Built already!" && exit 1; else echo "This version isn't built yet."; fi
|
||||
|
||||
- name: Update repositories
|
||||
run: sudo apt update
|
||||
- name: Install Docker
|
||||
uses: awalsh128/cache-apt-pkgs-action@latest
|
||||
with:
|
||||
packages: docker.io
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
# driver-opts: network=host
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
tags: jiriks74/nextcloud-extended:${{ steps.extract-version.outputs.version }},jiriks74/nextcloud-extended:${{ steps.extract-version.outputs.version-major }},jiriks74/nextcloud-extended:stable
|
||||
platforms: linux/amd64,linux/arm64
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue