ci : add Docker Hub and GitHub Packages registries
This commit is contained in:
parent
f4973641fc
commit
8229741370
2 changed files with 25 additions and 16 deletions
37
.github/workflows/build-and-push.yml
vendored
37
.github/workflows/build-and-push.yml
vendored
|
@ -1,12 +1,8 @@
|
|||
name: Build and push image from ref
|
||||
name: Build and push image
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
ref:
|
||||
description: "A ref from this repository, CirclesUBI/pathfinder2"
|
||||
required: true
|
||||
type: string
|
||||
image:
|
||||
description: "The desired name of the image to build"
|
||||
default: 'pathfinder2'
|
||||
|
@ -14,10 +10,6 @@ on:
|
|||
type: string
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
ref:
|
||||
description: "A ref from this repository, CirclesUBI/pathfinder2"
|
||||
required: true
|
||||
type: string
|
||||
image:
|
||||
description: "The desired name of the image to build"
|
||||
default: 'pathfinder2'
|
||||
|
@ -32,14 +24,13 @@ jobs:
|
|||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
|
||||
-
|
||||
name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ inputs.ref }}
|
||||
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
|
@ -52,6 +43,8 @@ jobs:
|
|||
with:
|
||||
images: |
|
||||
${{ vars.GC_REGISTRY }}/${{ vars.GC_PROJECT_ID }}/${{ inputs.image }}
|
||||
docker.io/${{ vars.DH_ORGANIZATION }}/${{ inputs.image }}
|
||||
ghcr.io/${{ github.repository_owner }}/${{ inputs.image }}
|
||||
labels: |
|
||||
org.opencontainers.image.title=${{ inputs.image }}
|
||||
org.opencontainers.image.vendor=CirclesUBI
|
||||
|
@ -74,15 +67,33 @@ jobs:
|
|||
token_format: 'access_token'
|
||||
|
||||
-
|
||||
name: Login to Container Registry
|
||||
name: Login to Google Cloud Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ vars.GC_REGISTRY }}
|
||||
username: 'oauth2accesstoken'
|
||||
password: '${{ steps.auth.outputs.access_token }}'
|
||||
|
||||
- name: Build and push Docker image
|
||||
-
|
||||
name: Login to Docker Hub Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: docker.io
|
||||
username: ${{ vars.DH_USERNAME }}
|
||||
password: ${{ secrets.DH_TOKEN }}
|
||||
|
||||
-
|
||||
name: Login to GitHub Packages Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
-
|
||||
name: Build and push Container image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
|
4
.github/workflows/dev.yml
vendored
4
.github/workflows/dev.yml
vendored
|
@ -10,8 +10,6 @@ jobs:
|
|||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
packages: write
|
||||
uses: ./.github/workflows/build-and-push.yml
|
||||
with:
|
||||
ref: "${{ github.ref }}"
|
||||
image: "pathfinder2"
|
||||
secrets: inherit
|
||||
|
|
Loading…
Reference in a new issue