GitHub Actions: Push Docker image to Gitea as well and delete old images from GCR

This commit is contained in:
Jan-Lukas Else 2022-09-23 11:50:07 +02:00
parent 37a9e1f29c
commit 3643f09b7b
1 changed files with 18 additions and 7 deletions

View File

@ -12,32 +12,43 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v2
with: with:
config-inline: | config-inline: |
[registry."docker.io"] [registry."docker.io"]
mirrors = ["mirror.gcr.io"] mirrors = ["mirror.gcr.io"]
- name: Login to GitHub container registry - name: Login to GitHub container registry
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Gitea container registry
uses: docker/login-action@v2
with:
registry: git.jlel.se
username: nologin
password: ${{ secrets.GITEA_TOKEN }}
- name: Test - name: Test
uses: docker/build-push-action@v2 uses: docker/build-push-action@v3
with: with:
push: false push: false
target: test target: test
tags: test tags: test
- name: Build base image - name: Build base image
uses: docker/build-push-action@v2 uses: docker/build-push-action@v3
with: with:
push: true push: true
target: base target: base
tags: ghcr.io/jlelse/goblog:latest tags: ghcr.io/jlelse/goblog:latest,git.jlel.se/jlelse/goblog:latest
- name: Build tools image - name: Build tools image
uses: docker/build-push-action@v2 uses: docker/build-push-action@v3
with: with:
push: true push: true
target: tools target: tools
tags: ghcr.io/jlelse/goblog:tools tags: ghcr.io/jlelse/goblog:tools,git.jlel.se/jlelse/goblog:tools
- name: Delete old untagged images
uses: camargo/delete-untagged-action@v1
with:
github-token: ${{ secrets.DELETE_PACKAGES_TOKEN }}
personal-account: true