55 lines
1.5 KiB
YAML
Raw Normal View History

2025-02-27 04:28:31 +00:00
name: Build and Push Docker Image to Gitea Registry
2025-02-25 10:41:51 -05:00
on:
workflow_dispatch:
2025-02-27 05:53:03 +00:00
inputs:
version:
description: 'Docker Image Version'
required: true
default: 'latest'
2025-02-25 10:41:51 -05:00
jobs:
build-and-push:
2025-02-25 10:41:51 -05:00
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
2025-02-28 05:04:49 +00:00
run: npm install
2025-02-25 10:41:51 -05:00
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
2025-02-27 04:28:31 +00:00
- name: Login to Gitea Container Registry
2025-02-25 10:41:51 -05:00
uses: docker/login-action@v2
with:
2025-02-27 04:28:31 +00:00
registry: git.d4m13n.dev
2025-02-27 05:38:31 +00:00
username: damienostler1@outlook.com # Store your Gitea registry username as a secret
password: ${{ secrets.PACKAGE_TOKEN }} # Store your Gitea registry token/password as a secret
2025-02-25 10:41:51 -05:00
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v4
with:
2025-02-27 04:28:31 +00:00
# Full image name including Gitea Registry URL
images: git.d4m13n.dev/damien/personal-website
2025-02-25 10:41:51 -05:00
tags: |
2025-02-27 05:53:03 +00:00
${{ github.event.inputs.version }} # Add version from workflow dispatch input
2025-02-25 10:41:51 -05:00
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
2025-02-27 04:28:31 +00:00
push: true # Enable push to registry
tags: ${{ steps.meta.outputs.tags }}
2025-02-27 01:32:40 -05:00
labels: ${{ steps.meta.outputs.labels }}