diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..1dd39ba --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,92 @@ +name: peertube-release-image + +on: + workflow_dispatch: + schedule: + - cron: "20 3 * * *" + push: + branches: + - "main" + +jobs: + release-image: + runs-on: ubuntu-latest + + env: + REGISTRY: git.send.nrw + DOCKER_ORG: sendnrw + IMAGE_NAME: peertube + DOCKER_LATEST: latest + RUNNER_TOOL_CACHE: /toolcache + + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker BuildX + uses: docker/setup-buildx-action@v3 + with: + config-inline: | + [registry."git.send.nrw"] + http = true + insecure = true + + - name: Login to registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Get latest PeerTube release + id: peertube + shell: bash + run: | + set -euo pipefail + + VERSION="$(python3 - <<'PY' + import json + import urllib.request + + url = "https://api.github.com/repos/Chocobozzz/PeerTube/releases/latest" + with urllib.request.urlopen(url) as response: + data = json.load(response) + + print(data["tag_name"]) + PY + )" + + VERSION_NO_V="${VERSION#v}" + + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "version_no_v=${VERSION_NO_V}" >> "$GITHUB_OUTPUT" + + echo "Latest PeerTube release: ${VERSION}" + + - name: Clone PeerTube source + shell: bash + run: | + set -euo pipefail + + git clone \ + --depth 1 \ + --branch "${{ steps.peertube.outputs.version }}" \ + https://github.com/Chocobozzz/PeerTube.git \ + peertube-src + + - name: Build and push PeerTube image + uses: docker/build-push-action@v6 + with: + context: ./peertube-src + file: ./peertube-src/support/docker/production/Dockerfile + platforms: | + linux/amd64 + pull: true + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.DOCKER_ORG }}/${{ env.IMAGE_NAME }}:${{ steps.peertube.outputs.version }} + ${{ env.REGISTRY }}/${{ env.DOCKER_ORG }}/${{ env.IMAGE_NAME }}:${{ steps.peertube.outputs.version_no_v }} + ${{ env.REGISTRY }}/${{ env.DOCKER_ORG }}/${{ env.IMAGE_NAME }}:production + ${{ env.REGISTRY }}/${{ env.DOCKER_ORG }}/${{ env.IMAGE_NAME }}:${{ env.DOCKER_LATEST }} + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.DOCKER_ORG }}/${{ env.IMAGE_NAME }}:buildcache + cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.DOCKER_ORG }}/${{ env.IMAGE_NAME }}:buildcache,mode=max \ No newline at end of file