Add docker hub
This commit is contained in:
34
.github/workflows/build-and-push.yml
vendored
34
.github/workflows/build-and-push.yml
vendored
@@ -31,40 +31,48 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
-
|
||||||
|
name: Checkout code
|
||||||
uses: actions/checkout@v5.0.0
|
uses: actions/checkout@v5.0.0
|
||||||
|
-
|
||||||
- name: Parse Caddy version
|
name: Parse Caddy version
|
||||||
id: version
|
id: version
|
||||||
run: echo "version=$(grep -oP '(?<=FROM caddy:)[0-9]+\.[0-9]+\.[0-9]+' ${{ matrix.variant.dockerfile }} | head -n 1)" >> $GITHUB_OUTPUT
|
run: echo "version=$(grep -oP '(?<=FROM caddy:)[0-9]+\.[0-9]+\.[0-9]+' ${{ matrix.variant.dockerfile }} | head -n 1)" >> $GITHUB_OUTPUT
|
||||||
|
-
|
||||||
- name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3.6.0
|
uses: docker/setup-qemu-action@v3.6.0
|
||||||
|
-
|
||||||
- name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3.11.1
|
uses: docker/setup-buildx-action@v3.11.1
|
||||||
with:
|
with:
|
||||||
driver-opts: image=moby/buildkit:v0.23.2@sha256:ddd1ca44b21eda906e81ab14a3d467fa6c39cd73b9a39df1196210edcb8db59e
|
driver-opts: image=moby/buildkit:v0.23.2@sha256:ddd1ca44b21eda906e81ab14a3d467fa6c39cd73b9a39df1196210edcb8db59e
|
||||||
|
-
|
||||||
- name: Login to GitHub Container Registry
|
name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v3.5.0
|
uses: docker/login-action@v3.5.0
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GH_TOKEN }}
|
password: ${{ secrets.GH_TOKEN }}
|
||||||
|
-
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3.5.0
|
||||||
|
with:
|
||||||
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Extract metadata (tags, labels) for Docker
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5.8.0
|
uses: docker/metadata-action@v5.8.0
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
ghcr.io/${{ github.actor }}/caddy-${{ matrix.variant.name }}
|
ghcr.io/${{ github.actor }}/caddy-${{ matrix.variant.name }}
|
||||||
|
${{ vars.DOCKERHUB_USERNAME }}/caddy-${{ matrix.variant.name }}
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=latest
|
type=raw,value=latest
|
||||||
type=raw,value=${{ steps.version.outputs.version }}
|
type=raw,value=${{ steps.version.outputs.version }}
|
||||||
type=sha,format=long,prefix=sha-
|
type=sha,format=long,prefix=sha-
|
||||||
|
-
|
||||||
- name: Build and push
|
name: Build and push
|
||||||
uses: docker/build-push-action@v6.18.0
|
uses: docker/build-push-action@v6.18.0
|
||||||
with:
|
with:
|
||||||
context: ${{ matrix.variant.context }}
|
context: ${{ matrix.variant.context }}
|
||||||
|
|||||||
Reference in New Issue
Block a user