workflow for git.nadeko.net
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 2m2s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 2m2s
This commit is contained in:
parent
306f2d5f12
commit
687567a09e
2 changed files with 74 additions and 10 deletions
68
.forgejo/workflows/docker-build-push.yaml
Normal file
68
.forgejo/workflows/docker-build-push.yaml
Normal file
|
@ -0,0 +1,68 @@
|
|||
name: Build and Push Docker Image
|
||||
|
||||
# Define when this workflow will run
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master # Trigger on pushes to master branch
|
||||
tags:
|
||||
- '[0-9]+.[0-9]+.[0-9]+' # Trigger on semantic version tags
|
||||
paths-ignore:
|
||||
- '.gitignore'
|
||||
- 'LICENSE'
|
||||
- 'README.md'
|
||||
- 'docker-compose.yml'
|
||||
workflow_dispatch: # Allow manual triggering of the workflow
|
||||
|
||||
# Define environment variables used throughout the workflow
|
||||
env:
|
||||
REGISTRY: git.nadeko.net
|
||||
IMAGE_NAME: fijxu/invidious-companion
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: runner
|
||||
|
||||
steps:
|
||||
# Step 1: Check out the repository code
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Step 3: Set up Docker Buildx for enhanced build capabilities
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
# Step 4: Authenticate with Quay.io registry
|
||||
- name: Login to Docker Container Registry (git.nadeko.net)
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.QUAY_USERNAME }}
|
||||
password: ${{ secrets.QUAY_PASSWORD }}
|
||||
|
||||
# Step 5: Extract metadata for Docker image tagging and labeling
|
||||
- name: Extract metadata for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
# Define tagging strategy
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
|
||||
type=sha,prefix={{branch}}-
|
||||
# Define labels
|
||||
labels: |
|
||||
quay.expires-after=12w
|
||||
|
||||
# Step 6: Build and push the Docker image
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
16
.github/workflows/docker-build-push.yaml
vendored
16
.github/workflows/docker-build-push.yaml
vendored
|
@ -16,29 +16,25 @@ on:
|
|||
|
||||
# Define environment variables used throughout the workflow
|
||||
env:
|
||||
REGISTRY: quay.io
|
||||
IMAGE_NAME: invidious/invidious-companion
|
||||
REGISTRY: git.nadeko.net
|
||||
IMAGE_NAME: fijxu/invidious-companion
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: runner
|
||||
|
||||
steps:
|
||||
# Step 1: Check out the repository code
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Step 2: Set up QEMU for multi-architecture builds
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
# Step 3: Set up Docker Buildx for enhanced build capabilities
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
# Step 4: Authenticate with Quay.io registry
|
||||
- name: Log in to Quay.io
|
||||
uses: docker/login-action@v2
|
||||
- name: Login to Docker Container Registry (git.nadeko.net)
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.QUAY_USERNAME }}
|
||||
|
@ -67,6 +63,6 @@ jobs:
|
|||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64 # Build for multiple architectures
|
||||
platforms: linux/amd64
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
|
Loading…
Reference in a new issue