diff --git a/.github/workflows/push-main.yml b/.github/workflows/push-main.yml deleted file mode 100644 index 0b16905..0000000 --- a/.github/workflows/push-main.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: push-main -on: - push: - branches: - - main -jobs: - build-push-amd64: - runs-on: ubuntu-latest - steps: - - name: Set repository as lower-case output variable - id: repo_name - run: echo ::set-output name=repository::$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') - - - name: Check out code into the Go module directory - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Docker meta - id: docker_meta - uses: docker/metadata-action@v5 - with: - images: ghcr.io/${{ steps.repo_name.outputs.repository }} - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Push to GitHub Container Registry - uses: docker/build-push-action@v5 - with: - push: true - tags: | - ghcr.io/${{ steps.repo_name.outputs.repository }}:latest-amd64 - labels: ${{ steps.docker_meta.outputs.labels }} - file: ./Dockerfile - - create-push-manifest: - needs: [build-push-amd64] - runs-on: ubuntu-latest - steps: - - name: Set repository as lower-case output variable - id: repo_name - run: echo ::set-output name=repository::$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Create manifest for multi-arch images - env: - REPOSITORY: ghcr.io/${{ steps.repo_name.outputs.repository }} - run: | - # Get artifacts from previous steps - docker pull ${{ env.REPOSITORY }}:latest-amd64 - # Create and update manifest - docker manifest create ${{ env.REPOSITORY }}:latest ${{ env.REPOSITORY }}:latest-amd64 - docker manifest annotate ${{ env.REPOSITORY }}:latest ${{ env.REPOSITORY }}:latest-amd64 --arch amd64 - # Push manifest - docker manifest push ${{ env.REPOSITORY }}:latest diff --git a/.github/workflows/push-master.yml b/.github/workflows/push-master.yml new file mode 100644 index 0000000..1182245 --- /dev/null +++ b/.github/workflows/push-master.yml @@ -0,0 +1,47 @@ +name: push-master +on: + push: + branches: + - master +jobs: + image-build-push: + runs-on: ubuntu-latest + steps: + - name: Set repository as lower-case output variable + id: repo_name + run: echo ::set-output name=repository::$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') + + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: docker_meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ steps.repo_name.outputs.repository }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push to GitHub Container Registry + uses: docker/build-push-action@v5 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64 + tags: | + ghcr.io/${{ steps.repo_name.outputs.repository }}:latest + labels: ${{ steps.docker_meta.outputs.labels }} + file: ./Dockerfile diff --git a/.github/workflows/push-release.yml b/.github/workflows/push-release.yml index a021057..dbf265e 100644 --- a/.github/workflows/push-release.yml +++ b/.github/workflows/push-release.yml @@ -4,8 +4,7 @@ on: tags: - v* jobs: - build-push-amd64: - name: Image push/amd64 + image-build-push: runs-on: ubuntu-latest steps: - name: Set repository as lower-case output variable @@ -14,12 +13,17 @@ jobs: - name: Check out code into the Go module directory uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry - uses: docker/login-action@v5 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -30,58 +34,19 @@ jobs: uses: docker/metadata-action@v5 with: images: ghcr.io/${{ steps.repo_name.outputs.repository }} + tags: | + type=ref,event=tag flavor: | latest=false - - name: Push container image + - name: Build and Push container image uses: docker/build-push-action@v5 with: context: . push: true + platforms: linux/amd64,linux/arm64 tags: | - ghcr.io/${{ steps.repo_name.outputs.repository }}:stable-amd64 - ${{ steps.docker_meta.outputs.tags }}-amd64 + ghcr.io/${{ steps.repo_name.outputs.repository }}:stable + ${{ steps.docker_meta.outputs.tags }} labels: ${{ steps.docker_meta.outputs.labels }} file: ./Dockerfile - - create-push-manifest: - needs: [build-push-amd64] - runs-on: ubuntu-latest - steps: - - name: Set repository as lower-case output variable - id: repo_name - run: echo ::set-output name=repository::$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Docker meta - id: docker_meta - uses: docker/metadata-action@v5 - with: - images: ghcr.io/${{ steps.repo_name.outputs.repository }} - flavor: | - latest=false - - - name: Login to GitHub Container Registry - uses: docker/login-action@v5 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Create manifest for multi-arch images - env: - REPOSITORY: ghcr.io/${{ steps.repo_name.outputs.repository }} - run: | - # Get artifacts from previous steps - docker pull ${{ steps.docker_meta.outputs.tags }}-amd64 - docker pull ${{ env.REPOSITORY }}:stable-amd64 - # Create and update manifests - docker manifest create ${{ steps.docker_meta.outputs.tags }} ${{ steps.docker_meta.outputs.tags }}-amd64 - docker manifest annotate ${{ steps.docker_meta.outputs.tags }} ${{ steps.docker_meta.outputs.tags }}-amd64 --arch amd64 - docker manifest create ${{ env.REPOSITORY }}:stable ${{ env.REPOSITORY }}:stable-amd64 - docker manifest annotate ${{ env.REPOSITORY }}:stable ${{ env.REPOSITORY }}:stable-amd64 --arch amd64 - # push manifests - docker manifest push ${{ steps.docker_meta.outputs.tags }} - docker manifest push ${{ env.REPOSITORY }}:stable