60 lines
1.5 KiB
YAML
Raw Normal View History

2025-02-27 04:28:21 +00:00
name: Build and Push Docker Image to Gitea Registry
2025-02-27 01:03:07 +00:00
on:
push:
branches: [ main ]
2025-02-27 04:28:21 +00:00
paths-ignore:
2025-02-27 01:03:07 +00:00
- '**.md'
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
2025-02-27 04:28:21 +00:00
build-and-push:
2025-02-27 01:03:07 +00: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:05:02 +00:00
run: npm install
2025-02-27 01:03:07 +00:00
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
2025-02-27 04:28:21 +00:00
- name: Login to Gitea Container Registry
uses: docker/login-action@v2
with:
registry: git.d4m13n.dev
2025-02-27 05:38:46 +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-27 04:28:21 +00:00
2025-02-27 01:03:07 +00:00
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v4
with:
2025-02-27 04:28:21 +00:00
# Full image name including Gitea Registry URL
2025-02-27 04:24:10 +00:00
images: git.d4m13n.dev/damien/personal-website
2025-02-27 01:03:07 +00:00
tags: |
type=ref,event=branch
type=ref,event=pr
type=sha
2025-02-27 04:28:21 +00:00
- name: Build and push Docker image
2025-02-27 01:03:07 +00:00
uses: docker/build-push-action@v4
with:
context: .
2025-02-27 04:28:21 +00:00
push: false # Enable push to registry
2025-02-27 01:03:07 +00:00
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}