/
githubmirror
/
gogs
Обзор
Документация
Войти
/
githubmirror
/
gogs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
.github/workflows/docker.yml
381 строка
15 KB
ᴊᴏᴇ ᴄʜᴇɴ
chore: delete digitalocean_gc workflow (#8315)
03 июн 2026, 06:37
Не верифицирован
03 июн 2026, 06:37
25b8874
Код
Авторство
О чём код?
name: Docker on: push: branches: - main pull_request: paths: - '.trivy.yaml' - 'Dockerfile' - 'Dockerfile.next' - 'docker/**' - 'docker-next/**' - '.github/workflows/docker.yml' release: types: [ published ] jobs: buildx-next: if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'gogs/gogs' }} concurrency: group: ${{ github.workflow }}-next-${{ github.ref }} cancel-in-progress: true runs-on: ubuntu-latest permissions: actions: write contents: read packages: write steps: - name: Check out code uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - name: Set up QEMU uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 with: platforms: linux/amd64,linux/arm64,linux/arm/v7 - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 - name: Inspect builder run: | echo "Name: ${{ steps.buildx.outputs.name }}" echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" echo "Status: ${{ steps.buildx.outputs.status }}" echo "Flags: ${{ steps.buildx.outputs.flags }}" echo "Platforms: ${{ steps.buildx.outputs.platforms }}" - name: Login to Docker Hub uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to GitHub Container registry uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Login to DigitalOcean Container registry uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 with: registry: registry.digitalocean.com username: ${{ secrets.DIGITALOCEAN_USERNAME }} password: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} - name: Build and push next-gen images uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 with: context: . file: Dockerfile.next platforms: linux/amd64,linux/arm64,linux/arm/v7 push: true tags: | gogs/gogs:edge ghcr.io/gogs/gogs:edge registry.digitalocean.com/gogs/gogs:edge - name: Scan for container vulnerabilities uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # 0.35.0 with: image-ref: gogs/gogs:edge exit-code: '1' - name: Send email on failure uses: unknwon/send-email-on-failure@89339a1bc93f4ad1d30f3b7e4911fcba985c9adb # v1 if: ${{ failure() }} with: smtp_username: ${{ secrets.SMTP_USERNAME }} smtp_password: ${{ secrets.SMTP_PASSWORD }} deploy-demo: if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'gogs/gogs' }} needs: buildx-next runs-on: ubuntu-latest permissions: contents: read steps: - name: Configure kubectl run: | mkdir -p ~/.kube echo "${KUBECONFIG}" | base64 -d > ~/.kube/config env: KUBECONFIG: ${{ secrets.DIGITALOCEAN_K8S_CLUSTER_KUBECONFIG }} - name: Restart gogs-demo deployment timeout-minutes: 5 run: | set -ex kubectl rollout restart deployment gogs-demo -n gogs kubectl rollout status deployment gogs-demo -n gogs - name: Send email on failure uses: unknwon/send-email-on-failure@89339a1bc93f4ad1d30f3b7e4911fcba985c9adb # v1 if: ${{ failure() }} with: smtp_username: ${{ secrets.SMTP_USERNAME }} smtp_password: ${{ secrets.SMTP_PASSWORD }} buildx-pull-request: if: ${{ github.event_name == 'pull_request'}} runs-on: ubuntu-latest permissions: contents: read steps: - name: Check out code uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 with: config-inline: | [worker.oci] max-parallelism = 2 - name: Inspect builder run: | echo "Name: ${{ steps.buildx.outputs.name }}" echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" echo "Status: ${{ steps.buildx.outputs.status }}" echo "Flags: ${{ steps.buildx.outputs.flags }}" echo "Platforms: ${{ steps.buildx.outputs.platforms }}" - name: Compute short commit SHA id: short-sha uses: benjlevesque/short-sha@599815c8ee942a9616c92bcfb4f947a3b670ab0b # v3.0 - name: Build and push images uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 with: context: . platforms: linux/amd64 push: true tags: | ttl.sh/gogs/gogs-${{ steps.short-sha.outputs.sha }}:7d - name: Scan for container vulnerabilities uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # 0.35.0 with: image-ref: ttl.sh/gogs/gogs-${{ steps.short-sha.outputs.sha }}:7d exit-code: '1' buildx-next-pull-request: if: ${{ github.event_name == 'pull_request'}} runs-on: ubuntu-latest permissions: contents: read steps: - name: Check out code uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 with: config-inline: | [worker.oci] max-parallelism = 2 - name: Inspect builder run: | echo "Name: ${{ steps.buildx.outputs.name }}" echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" echo "Status: ${{ steps.buildx.outputs.status }}" echo "Flags: ${{ steps.buildx.outputs.flags }}" echo "Platforms: ${{ steps.buildx.outputs.platforms }}" - name: Compute short commit SHA id: short-sha uses: benjlevesque/short-sha@599815c8ee942a9616c92bcfb4f947a3b670ab0b # v3.0 - name: Build and push next-gen images uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 with: context: . file: Dockerfile.next platforms: linux/amd64 push: true tags: | ttl.sh/gogs/gogs-next-${{ steps.short-sha.outputs.sha }}:7d - name: Scan for container vulnerabilities uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # 0.35.0 with: image-ref: ttl.sh/gogs/gogs-next-${{ steps.short-sha.outputs.sha }}:7d exit-code: '1' # Updates to the following section needs to be synced to all release branches within their lifecycles. buildx-release: if: ${{ github.event_name == 'release' }} runs-on: ubuntu-latest permissions: actions: write contents: read packages: write steps: - name: Check out code uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 with: # Full history with tags is required so the next step can determine # whether this release is the highest stable version across the repo. fetch-depth: 0 fetch-tags: true - name: Compute image tags run: | IMAGE_TAG=$(echo $GITHUB_REF_NAME | cut -c 2-) echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV TAGS="gogs/gogs:$IMAGE_TAG ghcr.io/gogs/gogs:$IMAGE_TAG" # For stable releases (no prerelease suffix per semver), add the # minor-version tag only if this release is the highest patch of that # minor line, and add `latest` only if this release is the highest # stable version across the repository. Back-patches on older lines # must not clobber moving tags. if [[ ! "$IMAGE_TAG" =~ - ]]; then STABLE_TAGS=$(git tag --list 'v*' | sed 's/^v//' | grep -v -- '-' || true) HIGHEST_STABLE=$(echo "$STABLE_TAGS" | sort -V | tail -n 1) MINOR_TAG=$(echo "$IMAGE_TAG" | cut -d. -f1,2) # `|| true` keeps the step running when `grep` finds no matches, # since bash runs with `-e -o pipefail` in GitHub Actions. HIGHEST_IN_MINOR=$(echo "$STABLE_TAGS" | { grep "^${MINOR_TAG}\." || true; } | sort -V | tail -n 1) if [[ "$IMAGE_TAG" == "$HIGHEST_IN_MINOR" ]]; then TAGS="$TAGS gogs/gogs:$MINOR_TAG ghcr.io/gogs/gogs:$MINOR_TAG" fi if [[ "$IMAGE_TAG" == "$HIGHEST_STABLE" ]]; then TAGS="$TAGS gogs/gogs:latest ghcr.io/gogs/gogs:latest" fi fi echo "TAGS<<EOF" >> $GITHUB_ENV echo "$TAGS" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV - name: Set up QEMU uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 with: platforms: linux/amd64,linux/arm64,linux/arm/v7 - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 - name: Inspect builder run: | echo "Name: ${{ steps.buildx.outputs.name }}" echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" echo "Status: ${{ steps.buildx.outputs.status }}" echo "Flags: ${{ steps.buildx.outputs.flags }}" echo "Platforms: ${{ steps.buildx.outputs.platforms }}" - name: Login to Docker Hub uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to GitHub Container registry uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push images uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 with: context: . platforms: linux/amd64,linux/arm64,linux/arm/v7 push: true tags: ${{ env.TAGS }} - name: Scan for container vulnerabilities uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # 0.35.0 with: image-ref: gogs/gogs:${{ env.IMAGE_TAG }} exit-code: '1' - name: Send email on failure uses: unknwon/send-email-on-failure@89339a1bc93f4ad1d30f3b7e4911fcba985c9adb # v1 if: ${{ failure() }} with: smtp_username: ${{ secrets.SMTP_USERNAME }} smtp_password: ${{ secrets.SMTP_PASSWORD }} # Updates to the following section needs to be synced to all release branches within their lifecycles. buildx-next-release: if: ${{ github.event_name == 'release' }} runs-on: ubuntu-latest permissions: actions: write contents: read packages: write steps: - name: Check out code uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 with: # Full history with tags is required so the next step can determine # whether this release is the highest stable version across the repo. fetch-depth: 0 fetch-tags: true - name: Compute image tags run: | IMAGE_TAG=$(echo $GITHUB_REF_NAME | cut -c 2-) echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV TAGS="gogs/gogs:next-$IMAGE_TAG ghcr.io/gogs/gogs:next-$IMAGE_TAG" # For stable releases (no prerelease suffix per semver), add the # minor-version tag only if this release is the highest patch of that # minor line, and add `next-latest` only if this release is the # highest stable version across the repository. Back-patches on older # lines must not clobber moving tags. if [[ ! "$IMAGE_TAG" =~ - ]]; then STABLE_TAGS=$(git tag --list 'v*' | sed 's/^v//' | grep -v -- '-' || true) HIGHEST_STABLE=$(echo "$STABLE_TAGS" | sort -V | tail -n 1) MINOR_TAG=$(echo "$IMAGE_TAG" | cut -d. -f1,2) # `|| true` keeps the step running when `grep` finds no matches, # since bash runs with `-e -o pipefail` in GitHub Actions. HIGHEST_IN_MINOR=$(echo "$STABLE_TAGS" | { grep "^${MINOR_TAG}\." || true; } | sort -V | tail -n 1) if [[ "$IMAGE_TAG" == "$HIGHEST_IN_MINOR" ]]; then TAGS="$TAGS gogs/gogs:next-$MINOR_TAG ghcr.io/gogs/gogs:next-$MINOR_TAG" fi if [[ "$IMAGE_TAG" == "$HIGHEST_STABLE" ]]; then TAGS="$TAGS gogs/gogs:next-latest ghcr.io/gogs/gogs:next-latest" fi fi echo "TAGS<<EOF" >> $GITHUB_ENV echo "$TAGS" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV - name: Set up QEMU uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 with: platforms: linux/amd64,linux/arm64,linux/arm/v7 - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 - name: Inspect builder run: | echo "Name: ${{ steps.buildx.outputs.name }}" echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" echo "Status: ${{ steps.buildx.outputs.status }}" echo "Flags: ${{ steps.buildx.outputs.flags }}" echo "Platforms: ${{ steps.buildx.outputs.platforms }}" - name: Login to Docker Hub uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to GitHub Container registry uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push next-gen images uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 with: context: . file: Dockerfile.next platforms: linux/amd64,linux/arm64,linux/arm/v7 push: true tags: ${{ env.TAGS }} - name: Scan for container vulnerabilities uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # 0.35.0 with: image-ref: gogs/gogs:next-${{ env.IMAGE_TAG }} exit-code: '1' - name: Send email on failure uses: unknwon/send-email-on-failure@89339a1bc93f4ad1d30f3b7e4911fcba985c9adb # v1 if: ${{ failure() }} with: smtp_username: ${{ secrets.SMTP_USERNAME }} smtp_password: ${{ secrets.SMTP_PASSWORD }}