diff --git a/.github/workflows/bridge-proxy.yml b/.github/workflows/bridge-proxy.yml index 74b2ca6..18ac040 100644 --- a/.github/workflows/bridge-proxy.yml +++ b/.github/workflows/bridge-proxy.yml @@ -13,7 +13,7 @@ on: - .github/workflows/bridge-proxy.yml env: - REGISTRY: ghcr.io + REGISTRY: ${{ github.server_url == 'https://github.com' && 'ghcr.io' || 'git.ipao.vip' }} IMAGE_NAME: ${{ github.repository }}/bridge-proxy jobs: @@ -36,23 +36,26 @@ jobs: with: go-version-file: bridge-proxy/go.mod cache-dependency-path: bridge-proxy/go.mod + cache: ${{ github.server_url == 'https://github.com' }} - name: Test run: go test ./... - name: Set up QEMU uses: docker/setup-qemu-action@v3 + with: + cache-image: ${{ github.server_url == 'https://github.com' }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Log in to GHCR + - name: Log in to container registry if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + username: ${{ github.server_url == 'https://github.com' && github.actor || github.repository_owner }} + password: ${{ github.server_url == 'https://github.com' && secrets.GITHUB_TOKEN || secrets.PACKAGE_TOKEN }} - name: Extract metadata id: meta @@ -75,6 +78,6 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: ${{ github.server_url == 'https://github.com' && 'type=gha' || '' }} + cache-to: ${{ github.server_url == 'https://github.com' && 'type=gha,mode=max' || '' }} platforms: linux/amd64,linux/arm64 diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 61a9f23..7ca1c93 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -8,7 +8,7 @@ on: branches: [main, master] env: - REGISTRY: ghcr.io + REGISTRY: ${{ github.server_url == 'https://github.com' && 'ghcr.io' || 'git.ipao.vip' }} IMAGE_NAME: ${{ github.repository }} jobs: @@ -24,17 +24,19 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v3 + with: + cache-image: ${{ github.server_url == 'https://github.com' }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Log in to GHCR + - name: Log in to container registry if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + username: ${{ github.server_url == 'https://github.com' && github.actor || github.repository_owner }} + password: ${{ github.server_url == 'https://github.com' && secrets.GITHUB_TOKEN || secrets.PACKAGE_TOKEN }} - name: Extract metadata id: meta @@ -58,6 +60,6 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: ${{ github.server_url == 'https://github.com' && 'type=gha' || '' }} + cache-to: ${{ github.server_url == 'https://github.com' && 'type=gha,mode=max' || '' }} platforms: linux/amd64,linux/arm64