Skip to content

Commit

Permalink
feat: Docker Registry
Browse files Browse the repository at this point in the history
  • Loading branch information
DarrenOfficial committed Mar 4, 2024
1 parent a33598c commit b7a8f44
Showing 1 changed file with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions .woodpecker/publish-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#
# Copyright 2023-2024 Martin Goellnitz.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

env:
REGISTRY: git.dpaste.org
IMAGE_NAME: ${{ env.REGISTRY }}/dmb/develop-build

jobs:
build:

# runs-on: provocon
container:
image: debian:stable-slim
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
# Docker and Node.js are not part of the base image
- name: Prepare Tools
run: apt update ; apt install -yq nodejs docker.io curl

- name: Checkout repository
uses: actions/checkout@v4

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@v3

# Use QEmu for multi architecture build
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3

# Log into registry except on PR
# https://github.com/docker/login-action
- name: Log into project registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DPASTE_USER }}
password: ${{ secrets.DPASTE_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: https://github.com/docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
provenance: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit b7a8f44

Please sign in to comment.