diff --git a/.forgejo/workflows/build_nextcloud.yml b/.forgejo/workflows/build_nextcloud.yml new file mode 100644 index 0000000..e69aaeb --- /dev/null +++ b/.forgejo/workflows/build_nextcloud.yml @@ -0,0 +1,39 @@ +name: Build Nextcloud + +on: + workflow_dispatch: {} + push: {} + schedule: + - cron: "@daily" + +jobs: + build-container: + name: Build Container + runs-on: docker + container: + image: ghcr.io/osscontainertools/kaniko:alpine + strategy: + matrix: + nextcloud-version: [ 30, 31, 32 ] + steps: + - name: Install required system packages + run: apk add --no-cache nodejs + + - name: Build Container + uses: actions/checkout@v6 + + - name: Build Container + env: + KANIKO_NO_PUSH: ${{ forgejo.ref_name != 'main' }} + KANIKO_GIT_HAMBURG_CCC_DE_USER: forgejo-actions + KANIKO_GIT_HAMBURG_CCC_DE_PASSWORD: ${{ secrets.PACKAGES_TOKEN }} + run: /kaniko/executor + --dockerfile="${{forgejo.workspace }}/Containerfile" + --context="dir://${{ forgejo.workspace }}/nextcloud" + --build-arg=TAG=${{ matrix.nextcloud-version }} + --destination=git.hamburg.ccc.de/ccchh/oci-images/nextcloud:${{ matrix.nextcloud-version }} + --no-push-cache + --credential-helpers=env + --annotation=org.opencontainers.image.ref.name=nextcloud + --annotation=org.opencontainers.image.url=${{ forgejo.server_url }}/${{ forgejo.repository }} + --annotation=org.opencontainers.image.source=${{ forgejo.server_url }}/${{ forgejo.repository }} diff --git a/.woodpecker/nextcloud.yaml b/.woodpecker/nextcloud.yaml deleted file mode 100644 index 4639448..0000000 --- a/.woodpecker/nextcloud.yaml +++ /dev/null @@ -1,78 +0,0 @@ -when: - - event: push - path: - - 'nextcloud/**' - - '.woodpecker/nextcloud.yaml' - - event: cron - cron: daily - -# Manually set a workspace path, so we can use it literally, without using -# ${CI_WORKSPACE}, when running kaniko, since using ${CI_WORKSPACE} doesn't work. -# https://github.com/woodpecker-ci/woodpecker/issues/3982 -workspace: - path: src - -# Use matrix to set NEXTCLOUD_VERSION instead of setting the NEXTCLOUD_VERSION as -# an environment variable in the build-images step, since string substitution -# doesn't work for custom environment variables. -# https://github.com/woodpecker-ci/woodpecker/issues/3983 -# Also because global environment variables aren't a thing. -matrix: - NEXTCLOUD_VERSION: - - 30 - - 31 - - 32 - IMAGE_NAME: - - git.hamburg.ccc.de/ccchh/oci-images/nextcloud - -steps: - - name: setup-image-path - image: docker.io/library/alpine - commands: - - mkdir /woodpecker/images - - - name: build-image - image: gcr.io/kaniko-project/executor - entrypoint: - - /kaniko/executor - - --context=dir:///woodpecker/src/nextcloud - - --dockerfile=./Containerfile - - --build-arg=TAG=${NEXTCLOUD_VERSION} - - --destination=${IMAGE_NAME}:${NEXTCLOUD_VERSION} - - --no-push - - --tar-path=/woodpecker/images/nextcloud.tar - - - name: publish-image - image: docker.io/library/alpine - environment: - GIT_API_TOKEN: - from_secret: GIT_API_TOKEN - commands: - - apk -u add crane - - crane auth login git.hamburg.ccc.de -u woodpecker -p $GIT_API_TOKEN - - crane push /woodpecker/images/nextcloud.tar $IMAGE_NAME:$NEXTCLOUD_VERSION-$CI_COMMIT_BRANCH - - - name: tag-version - image: docker.io/library/alpine - when: - - branch: main - environment: - GIT_API_TOKEN: - from_secret: GIT_API_TOKEN - commands: - - apk -u add crane - - crane auth login git.hamburg.ccc.de -u woodpecker -p $GIT_API_TOKEN - - crane tag $IMAGE_NAME:$NEXTCLOUD_VERSION-$CI_COMMIT_BRANCH $NEXTCLOUD_VERSION - - - name: tag-latest - image: docker.io/library/alpine - when: - - branch: main - evaluate: 'NEXTCLOUD_VERSION == "29"' - environment: - GIT_API_TOKEN: - from_secret: GIT_API_TOKEN - commands: - - apk -u add crane - - crane auth login git.hamburg.ccc.de -u woodpecker -p $GIT_API_TOKEN - - crane tag $IMAGE_NAME:$NEXTCLOUD_VERSION-$CI_COMMIT_BRANCH latest