From bb455a3eb77b68bf12cd2805c1d74b383a3eb7e5 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Sat, 10 Jan 2026 15:51:06 +0800 Subject: [PATCH] merge ghcr to build.yml --- .github/workflows/build.yaml | 28 +++ .github/workflows/ghcr.yml | 335 ----------------------------------- 2 files changed, 28 insertions(+), 335 deletions(-) delete mode 100644 .github/workflows/ghcr.yml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 11a93fc..bd0deb1 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -7,6 +7,10 @@ name: build # DOCKER_HUB_USERNAME is the username you normally use to login at https://hub.docker.com/ # DOCKER_HUB_PASSWORD is a token you should create under "account settings / security" with read/write access +permissions: + contents: read + packages: write + on: workflow_dispatch: push: @@ -19,6 +23,8 @@ on: env: CARGO_TERM_COLOR: always LATEST_TAG: latest + GHCR_IMAGE: ghcr.io/${{ github.repository_owner }}/rustdesk-server-s6 + GHCR_IMAGE_CLASSIC: ghcr.io/${{ github.repository_owner }}/rustdesk-server jobs: @@ -250,6 +256,14 @@ jobs: with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_PASSWORD }} + + - name: Log in to GHCR + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta @@ -278,6 +292,9 @@ jobs: ${{ secrets.DOCKER_IMAGE }}:${{ env.LATEST_TAG }}-${{ matrix.job.name }} ${{ secrets.DOCKER_IMAGE }}:${{ env.GIT_TAG }}-${{ matrix.job.name }} ${{ secrets.DOCKER_IMAGE }}:${{ env.MAJOR_TAG }}-${{ matrix.job.name }} + ${{ env.GHCR_IMAGE }}:${{ env.LATEST_TAG }}-${{ matrix.job.name }} + ${{ env.GHCR_IMAGE }}:${{ env.GIT_TAG }}-${{ matrix.job.name }} + ${{ env.GHCR_IMAGE }}:${{ env.MAJOR_TAG }}-${{ matrix.job.name }} labels: ${{ steps.meta.outputs.labels }} # docker build and push of multiarch images @@ -373,6 +390,14 @@ jobs: with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_PASSWORD }} + + - name: Log in to GHCR + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta @@ -399,6 +424,9 @@ jobs: ${{ secrets.DOCKER_IMAGE_CLASSIC }}:${{ env.LATEST_TAG }}-${{ matrix.job.name }} ${{ secrets.DOCKER_IMAGE_CLASSIC }}:${{ env.GIT_TAG }}-${{ matrix.job.name }} ${{ secrets.DOCKER_IMAGE_CLASSIC }}:${{ env.MAJOR_TAG }}-${{ matrix.job.name }} + ${{ env.GHCR_IMAGE_CLASSIC }}:${{ env.LATEST_TAG }}-${{ matrix.job.name }} + ${{ env.GHCR_IMAGE_CLASSIC }}:${{ env.GIT_TAG }}-${{ matrix.job.name }} + ${{ env.GHCR_IMAGE_CLASSIC }}:${{ env.MAJOR_TAG }}-${{ matrix.job.name }} labels: ${{ steps.meta.outputs.labels }} # docker build and push of multiarch images diff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.yml deleted file mode 100644 index f141118..0000000 --- a/.github/workflows/ghcr.yml +++ /dev/null @@ -1,335 +0,0 @@ -name: Build and publish to ghcr.io - -on: - workflow_dispatch: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' - - '[0-9]+.[0-9]+.[0-9]+' - - 'v[0-9]+.[0-9]+.[0-9]+-[0-9]+' - - '[0-9]+.[0-9]+.[0-9]+-[0-9]+' - -env: - CARGO_TERM_COLOR: always - LATEST_TAG: latest - -permissions: - contents: read - packages: write # So need to set "secrets.GITHUB_TOKEN" - -jobs: - - # Binary build - build: - name: Build - ${{ matrix.job.name }} - runs-on: ubuntu-24.04 - strategy: - fail-fast: false - matrix: - job: - - { name: "amd64", target: "x86_64-unknown-linux-musl" } - - { name: "arm64v8", target: "aarch64-unknown-linux-musl" } - - { name: "armv7", target: "armv7-unknown-linux-musleabihf" } - - { name: "i386", target: "i686-unknown-linux-musl" } - #- { name: "amd64fb", target: "x86_64-unknown-freebsd" } - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@v1 - with: - toolchain: "1.70.0" - targets: ${{ matrix.job.target }} - components: "rustfmt" - - - uses: Swatinem/rust-cache@v2 - with: - prefix-key: ${{ matrix.job.os }} - - - name: Build - uses: actions-rs/cargo@v1 - with: - command: build - args: --release --all-features --target=${{ matrix.job.target }} - use-cross: true - - - name: Exec chmod - run: chmod -v a+x target/${{ matrix.job.target }}/release/* - - - name: Publish Artifacts - uses: actions/upload-artifact@v4 - with: - name: binaries-linux-${{ matrix.job.name }} - path: | - target/${{ matrix.job.target }}/release/hbbr - target/${{ matrix.job.target }}/release/hbbs - target/${{ matrix.job.target }}/release/rustdesk-utils - if-no-files-found: error - - # Build and push single-arch Docker images to ghcr.io - create-s6-overlay-images: - name: Docker push - ${{ matrix.job.name }} - needs: build - runs-on: ubuntu-24.04 - strategy: - fail-fast: false - matrix: - job: - - { name: "amd64", docker_platform: "linux/amd64", s6_platform: "x86_64" } - - { name: "arm64v8", docker_platform: "linux/arm64", s6_platform: "aarch64" } - - { name: "armv7", docker_platform: "linux/arm/v7", s6_platform: "armhf" } - - { name: "i386", docker_platform: "linux/386", s6_platform: "i686" } - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Download binaries - uses: actions/download-artifact@v4 - with: - pattern: binaries-linux-${{ matrix.job.name }} - path: docker/rootfs/usr/bin - merge-multiple: true - - - name: Make binaries executable - run: chmod -v a+x docker/rootfs/usr/bin/* - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to GitHub Container Registry - if: github.event_name != 'pull_request' - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ghcr.io/${{ github.repository }}-s6 - - - name: Get git tag - id: vars - run: | - T=${GITHUB_REF#refs/*/} - M=${T%%.*} - echo "GIT_TAG=$T" >> $GITHUB_ENV - echo "MAJOR_TAG=$M" >> $GITHUB_ENV - - - name: Build and push Docker image - uses: docker/build-push-action@v6 - with: - context: "./docker" - platforms: ${{ matrix.job.docker_platform }} - push: true - provenance: false - build-args: | - S6_ARCH=${{ matrix.job.s6_platform }} - tags: | - ghcr.io/${{ github.repository }}-s6:${{ env.LATEST_TAG }}-${{ matrix.job.name }} - ghcr.io/${{ github.repository }}-s6:${{ env.GIT_TAG }}-${{ matrix.job.name }} - ghcr.io/${{ github.repository }}-s6:${{ env.MAJOR_TAG }}-${{ matrix.job.name }} - labels: ${{ steps.meta.outputs.labels }} - - # Set up minifest and tag for pushed image - create-s6-overlay-images-manifest: - name: Manifest for s6-overlay images - needs: create-s6-overlay-images - runs-on: ubuntu-24.04 - - steps: - - name: Log in to GitHub Container Registry - if: github.event_name != 'pull_request' - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Get git tag - id: vars - run: | - T=${GITHUB_REF#refs/*/} - M=${T%%.*} - echo "GIT_TAG=$T" >> $GITHUB_ENV - echo "MAJOR_TAG=$M" >> $GITHUB_ENV - - # Create and push manifest for :ve.rs.ion tag - - name: Create and push manifest (:ve.rs.ion) - uses: Noelware/docker-manifest-action@master - if: github.event_name != 'workflow_dispatch' - with: - base-image: ghcr.io/${{ github.repository }}-s6:${{ env.GIT_TAG }} - extra-images: | - ghcr.io/${{ github.repository }}-s6:${{ env.GIT_TAG }}-amd64, - ghcr.io/${{ github.repository }}-s6:${{ env.GIT_TAG }}-arm64v8, - ghcr.io/${{ github.repository }}-s6:${{ env.GIT_TAG }}-armv7, - ghcr.io/${{ github.repository }}-s6:${{ env.GIT_TAG }}-i386 - push: true - - # Create and push manifest for :major tag - - name: Create and push manifest (:major) - uses: Noelware/docker-manifest-action@master - with: - base-image: ghcr.io/${{ github.repository }}-s6:${{ env.MAJOR_TAG }} - extra-images: | - ghcr.io/${{ github.repository }}-s6:${{ env.MAJOR_TAG }}-amd64, - ghcr.io/${{ github.repository }}-s6:${{ env.MAJOR_TAG }}-arm64v8, - ghcr.io/${{ github.repository }}-s6:${{ env.MAJOR_TAG }}-armv7, - ghcr.io/${{ github.repository }}-s6:${{ env.MAJOR_TAG }}-i386 - push: true - - # Create and push manifest for :latest tag - - name: Create and push manifest (:latest) - uses: Noelware/docker-manifest-action@master - with: - base-image: ghcr.io/${{ github.repository }}-s6:${{ env.LATEST_TAG }} - extra-images: | - ghcr.io/${{ github.repository }}-s6:${{ env.LATEST_TAG }}-amd64, - ghcr.io/${{ github.repository }}-s6:${{ env.LATEST_TAG }}-arm64v8, - ghcr.io/${{ github.repository }}-s6:${{ env.LATEST_TAG }}-armv7, - ghcr.io/${{ github.repository }}-s6:${{ env.LATEST_TAG }}-i386 - push: true - - # Build and push single-arch Docker images to ghcr.io - create-classic-images: - name: Docker push - ${{ matrix.job.name }} - needs: build - runs-on: ubuntu-24.04 - strategy: - fail-fast: false - matrix: - job: - - { name: "amd64", docker_platform: "linux/amd64" } - - { name: "arm64v8", docker_platform: "linux/arm64" } - - { name: "armv7", docker_platform: "linux/arm/v7" } - - { name: "i386", docker_platform: "linux/386" } - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Download binaries - uses: actions/download-artifact@v4 - with: - pattern: binaries-linux-${{ matrix.job.name }} - path: docker-classic - merge-multiple: true - - - name: Make binaries executable - run: chmod -v a+x docker-classic/* - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to GitHub Container Registry - if: github.event_name != 'pull_request' - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ghcr.io/${{ github.repository }} - - - name: Get git tag - id: vars - run: | - T=${GITHUB_REF#refs/*/} - M=${T%%.*} - echo "GIT_TAG=$T" >> $GITHUB_ENV - echo "MAJOR_TAG=$M" >> $GITHUB_ENV - - - name: Build and push Docker image - uses: docker/build-push-action@v6 - with: - context: "./docker-classic" - platforms: ${{ matrix.job.docker_platform }} - push: true - provenance: false - tags: | - ghcr.io/${{ github.repository }}:${{ env.LATEST_TAG }}-${{ matrix.job.name }} - ghcr.io/${{ github.repository }}:${{ env.GIT_TAG }}-${{ matrix.job.name }} - ghcr.io/${{ github.repository }}:${{ env.MAJOR_TAG }}-${{ matrix.job.name }} - labels: ${{ steps.meta.outputs.labels }} - - # Set up minifest and tag for pushed image - create-classic-images-manifest: - name: Manifest for classic images - needs: create-classic-images - runs-on: ubuntu-24.04 - - steps: - - name: Log in to GitHub Container Registry - if: github.event_name != 'pull_request' - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Get git tag - id: vars - run: | - T=${GITHUB_REF#refs/*/} - M=${T%%.*} - echo "GIT_TAG=$T" >> $GITHUB_ENV - echo "MAJOR_TAG=$M" >> $GITHUB_ENV - - # Create and push manifest for :ve.rs.ion tag - - name: Create and push manifest (:ve.rs.ion) - uses: Noelware/docker-manifest-action@master - if: github.event_name != 'workflow_dispatch' - with: - base-image: ghcr.io/${{ github.repository }}:${{ env.GIT_TAG }} - extra-images: | - ghcr.io/${{ github.repository }}:${{ env.GIT_TAG }}-amd64, - ghcr.io/${{ github.repository }}:${{ env.GIT_TAG }}-arm64v8, - ghcr.io/${{ github.repository }}:${{ env.GIT_TAG }}-armv7, - ghcr.io/${{ github.repository }}:${{ env.GIT_TAG }}-i386 - push: true - - # Create and push manifest for :major tag - - name: Create and push manifest (:major) - uses: Noelware/docker-manifest-action@master - with: - base-image: ghcr.io/${{ github.repository }}:${{ env.MAJOR_TAG }} - extra-images: | - ghcr.io/${{ github.repository }}:${{ env.MAJOR_TAG }}-amd64, - ghcr.io/${{ github.repository }}:${{ env.MAJOR_TAG }}-arm64v8, - ghcr.io/${{ github.repository }}:${{ env.MAJOR_TAG }}-armv7, - ghcr.io/${{ github.repository }}:${{ env.MAJOR_TAG }}-i386 - push: true - - # Create and push manifest for :latest tag - - name: Create and push manifest (:latest) - uses: Noelware/docker-manifest-action@master - with: - base-image: ghcr.io/${{ github.repository }}:${{ env.LATEST_TAG }} - extra-images: | - ghcr.io/${{ github.repository }}:${{ env.LATEST_TAG }}-amd64, - ghcr.io/${{ github.repository }}:${{ env.LATEST_TAG }}-arm64v8, - ghcr.io/${{ github.repository }}:${{ env.LATEST_TAG }}-armv7, - ghcr.io/${{ github.repository }}:${{ env.LATEST_TAG }}-i386 - push: true