diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8ccd1d0a..00d6f70b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -242,29 +242,47 @@ jobs: run: ./test.sh --unprivileged --type oss # After the tests are done, build multiarch and push to both github packages and dockerhub if we are on master/main - # tag-and-push: - # runs-on: ubuntu-latest - # needs: [test-oss, test-latest-njs, test-unprivileged] + tag-and-push: + runs-on: ubuntu-latest + needs: [test-oss, test-latest-njs, test-unprivileged] - # if: | - # github.ref == 'refs/heads/master' || - # github.ref == 'refs/heads/main' - # steps: - # - name: Get current date - # id: date - # run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT - # - name: Configure Github Package Registry - # run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u $GITHUB_ACTOR --password-stdin + # if: | + # github.ref == 'refs/heads/master' || + # github.ref == 'refs/heads/main' + steps: + - uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + platforms: linux/amd64,linux/arm64 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push oss image to local registry + uses: docker/build-push-action@v5 + with: + file: Dockerfile.oss + context: . + push: true + platforms: linux/amd64,linux/arm64 + tags: | + # nginxinc/nginx-s3-gateway:latest-${{ steps.date.outputs.date }}-new-build-test + # nginxinc/nginx-s3-gateway:latest-new-build-test + ghcr.io/$GITHUB_REPOSITORY/nginx-oss-s3-gateway:latest-${{ steps.date.outputs.date }}-new-build-test + ghcr.io/$GITHUB_REPOSITORY/nginx-oss-s3-gateway:latest-new-build-test - # - name: Download artifact - oss - # uses: actions/download-artifact@v3 - # with: - # name: oss - # path: /tmp - # - name: Download artifact - latest-njs - # uses: actions/download-artifact@v3 - # with: - # name: latest-njs + # path: /tmp # - name: Download artifact - unprivileged # uses: actions/download-artifact@v3