|
4 | 4 | release:
|
5 | 5 | types: [published]
|
6 | 6 |
|
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + packages: write |
7 | 10 | jobs:
|
8 | 11 | build:
|
9 |
| - |
10 | 12 | runs-on: ubuntu-latest
|
11 |
| - |
12 | 13 | steps:
|
13 |
| - - uses: actions/checkout@v1 |
| 14 | + - uses: actions/checkout@v3 |
| 15 | + |
14 | 16 | - name: Generate Docker Tag
|
15 | 17 | run: |
|
16 | 18 | echo ${{ github.ref }} | cut -d '/' -f 3 > DOCKER_TAG
|
17 |
| - - name: Build and push container image |
18 |
| - run: | |
19 |
| - docker build --file build/Dockerfile.dist --tag ghcr.io/movetokube/postgres-operator:$(cat DOCKER_TAG) --tag movetokube/postgres-operator:$(cat DOCKER_TAG) . |
20 |
| - docker tag ghcr.io/movetokube/postgres-operator:$(cat DOCKER_TAG) ghcr.io/movetokube/postgres-operator:latest |
21 |
| - docker tag movetokube/postgres-operator:$(cat DOCKER_TAG) movetokube/postgres-operator:latest |
22 |
| - |
23 |
| - docker login ghcr.io --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} |
24 |
| - docker push ghcr.io/movetokube/postgres-operator:$(cat DOCKER_TAG) |
25 |
| - docker push ghcr.io/movetokube/postgres-operator:latest |
26 |
| - |
27 |
| - docker login --username ${{ secrets.DOCKER_USER }} --password ${{ secrets.DOCKER_TOKEN }} |
28 |
| - docker push movetokube/postgres-operator:$(cat DOCKER_TAG) |
29 |
| - docker push movetokube/postgres-operator:latest |
| 19 | + echo "DOCKER_TAG=$(cat DOCKER_TAG)" >> $GITHUB_ENV |
| 20 | +
|
| 21 | + - name: Set up QEMU |
| 22 | + uses: docker/setup-qemu-action@v2 |
| 23 | + |
| 24 | + - name: Set up Docker Buildx |
| 25 | + uses: docker/setup-buildx-action@v2 |
| 26 | + |
| 27 | + - name: Login to Docker Hub |
| 28 | + uses: docker/login-action@v2 |
| 29 | + with: |
| 30 | + username: ${{ secrets.DOCKER_USER }} |
| 31 | + password: ${{ secrets.DOCKER_TOKEN }} |
30 | 32 |
|
| 33 | + - name: Login to GitHub Container Registry |
| 34 | + uses: docker/login-action@v2 |
| 35 | + with: |
| 36 | + registry: ghcr.io |
| 37 | + username: ${{ github.repository_owner }} |
| 38 | + password: ${{ secrets.GITHUB_TOKEN }} |
31 | 39 |
|
| 40 | + - name: Build and push |
| 41 | + uses: docker/build-push-action@v4 |
| 42 | + with: |
| 43 | + context: . |
| 44 | + file: ./build/Dockerfile.dist |
| 45 | + platforms: linux/amd64,linux/arm64 |
| 46 | + push: true |
| 47 | + tags: | |
| 48 | + ghcr.io/movetokube/postgres-operator:latest |
| 49 | + ghcr.io/movetokube/postgres-operator:${{ env.DOCKER_TAG }} |
| 50 | + movetokube/postgres-operator:${{ env.DOCKER_TAG }} |
| 51 | + movetokube/postgres-operator:latest |
0 commit comments