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:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
ref:
|
|
||||||
description: "A ref from this repository, CirclesUBI/pathfinder2"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
image:
|
image:
|
||||||
description: "The desired name of the image to build"
|
description: "The desired name of the image to build"
|
||||||
default: 'pathfinder2'
|
default: 'pathfinder2'
|
||||||
|
@ -14,10 +10,6 @@ on:
|
||||||
type: string
|
type: string
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
ref:
|
|
||||||
description: "A ref from this repository, CirclesUBI/pathfinder2"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
image:
|
image:
|
||||||
description: "The desired name of the image to build"
|
description: "The desired name of the image to build"
|
||||||
default: 'pathfinder2'
|
default: 'pathfinder2'
|
||||||
|
@ -32,14 +24,13 @@ jobs:
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
id-token: write
|
id-token: write
|
||||||
|
packages: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Checkout repository
|
name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
|
||||||
ref: ${{ inputs.ref }}
|
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
|
@ -52,6 +43,8 @@ jobs:
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
${{ vars.GC_REGISTRY }}/${{ vars.GC_PROJECT_ID }}/${{ inputs.image }}
|
${{ vars.GC_REGISTRY }}/${{ vars.GC_PROJECT_ID }}/${{ inputs.image }}
|
||||||
|
docker.io/${{ vars.DH_ORGANIZATION }}/${{ inputs.image }}
|
||||||
|
ghcr.io/${{ github.repository_owner }}/${{ inputs.image }}
|
||||||
labels: |
|
labels: |
|
||||||
org.opencontainers.image.title=${{ inputs.image }}
|
org.opencontainers.image.title=${{ inputs.image }}
|
||||||
org.opencontainers.image.vendor=CirclesUBI
|
org.opencontainers.image.vendor=CirclesUBI
|
||||||
|
@ -74,15 +67,33 @@ jobs:
|
||||||
token_format: 'access_token'
|
token_format: 'access_token'
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Login to Container Registry
|
name: Login to Google Cloud Container Registry
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
registry: ${{ vars.GC_REGISTRY }}
|
registry: ${{ vars.GC_REGISTRY }}
|
||||||
username: 'oauth2accesstoken'
|
username: 'oauth2accesstoken'
|
||||||
password: '${{ steps.auth.outputs.access_token }}'
|
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
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
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:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
id-token: write
|
id-token: write
|
||||||
|
packages: write
|
||||||
uses: ./.github/workflows/build-and-push.yml
|
uses: ./.github/workflows/build-and-push.yml
|
||||||
with:
|
|
||||||
ref: "${{ github.ref }}"
|
|
||||||
image: "pathfinder2"
|
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
Loading…
Reference in a new issue