Use github token instead of bot accounts

This should be one credential less to manage.

Signed-off-by: Jean-Philippe Evrard <open-source@a.spamming.party>
This commit is contained in:
Jean-Philippe Evrard
2022-09-20 16:39:11 +02:00
parent 50d024c3f9
commit e34f1a0947
2 changed files with 33 additions and 8 deletions
+16 -4
View File
@@ -5,6 +5,11 @@ on:
push:
branches:
- main
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
tag-scan-and-push-final-image:
name: "Build, scan, and publish tagged image"
@@ -27,9 +32,15 @@ jobs:
- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: weave-ghcr-bot
password: ${{ secrets.KURED_WEAVE_GHCR_BOT_TOKEN }}
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -50,4 +61,5 @@ jobs:
platforms: linux/arm64, linux/amd64, linux/arm/v7, linux/arm/v6, linux/386
push: true
tags: |
ghcr.io/${{ GITHUB.REPOSITORY }}:main-${{ steps.tags.outputs.sha_short }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main-${{ steps.tags.outputs.sha_short }}
labels: ${{ steps.meta.outputs.labels }}
+17 -4
View File
@@ -7,6 +7,11 @@ on:
push:
tags:
- "*"
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
tag-scan-and-push-final-image:
name: "Build, scan, and publish tagged image"
@@ -38,9 +43,15 @@ jobs:
- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: weave-ghcr-bot
password: ${{ secrets.KURED_WEAVE_GHCR_BOT_TOKEN }}
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -59,4 +70,6 @@ jobs:
# cache-from: type=registry,ref=user/app:buildcache
# cache-to: type=inline
tags: |
ghcr.io/${{ GITHUB.REPOSITORY }}:${{ steps.tags.outputs.version }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.version }}
labels: ${{ steps.meta.outputs.labels }}