Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1fdef1bcc8 | |||
| 53ba636258 | |||
| a25f5f602e | |||
| b9370eb2d5 | |||
| 7c6fba9b3f | |||
| 4eb8324056 | |||
| 6cb78c91fa | |||
| a9184acd23 | |||
| fae1979e04 | |||
| 36f2f0c2f9 | |||
| 35d4eccdfd | |||
| a81f67536f | |||
| ce68860175 | |||
| becc41a5f0 |
@@ -0,0 +1,100 @@
|
||||
name: Build & Push Docker image
|
||||
|
||||
on:
|
||||
# Trigger on pushes to main or release branches, and on manual workflow dispatch
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- 'release/**'
|
||||
- 'beta/**'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
environment: production
|
||||
steps:
|
||||
- name: Convert to lowercase
|
||||
id: github_repository_to_lowercase
|
||||
run: |
|
||||
# Grab the value (you can also use `${{ github.ref }}`, `${{ secrets.MY_SECRET }}`, etc.)
|
||||
raw_value="${{ github.repository }}"
|
||||
# Convert to lower case
|
||||
lower_value=$(echo "$raw_value" | tr '[:upper:]' '[:lower:]')
|
||||
# Export it to the workflow environment
|
||||
# echo "MY_LOWER=$lower_value" >> $GITHUB_ENV
|
||||
# If you want to use it as an output of this step:
|
||||
echo "lowercase=$lower_value" >> $GITHUB_OUTPUT
|
||||
# ------------------------------------------------------------------
|
||||
# 1. Checkout repository
|
||||
# ------------------------------------------------------------------
|
||||
- name: Checkout source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # needed for git rev‑parse and tag generation
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# 2. Set up Docker Buildx (optional, but recommended for multi‑arch)
|
||||
# ------------------------------------------------------------------
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# 3. Log in to the Gitea container registry
|
||||
# ------------------------------------------------------------------
|
||||
- name: Log in to Gitea registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ secrets.REGISTRY_HOST }} # e.g. registry.example.com
|
||||
username: ${{ secrets.REGISTRY_USER }} # e.g. admin
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }} # e.g. <api‑token>
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# 4. Build the Docker image
|
||||
# ------------------------------------------------------------------
|
||||
- name: Build image
|
||||
id: build
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: TinfoilVibeServer/Dockerfile
|
||||
# do not push yet
|
||||
push: false
|
||||
tags: |
|
||||
${{ vars.REGISTRY_HOST }}/${{ steps.github_repository_to_lowercase.outputs.lowercase }}:${{ github.sha }}
|
||||
${{ vars.REGISTRY_HOST }}/${{ steps.github_repository_to_lowercase.outputs.lowercase }}:${{ github.ref_name }}
|
||||
${{ vars.REGISTRY_HOST }}/${{ steps.github_repository_to_lowercase.outputs.lowercase }}:latest
|
||||
build-args: |
|
||||
# Add any build args here
|
||||
# ARG_NAME=VALUE
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# 5. Push the image to the registry
|
||||
# ------------------------------------------------------------------
|
||||
- name: Push image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: TinfoilVibeServer/Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
${{ vars.REGISTRY_HOST }}/${{ steps.github_repository_to_lowercase.outputs.lowercase }}:${{ github.sha }}
|
||||
${{ vars.REGISTRY_HOST }}/${{ steps.github_repository_to_lowercase.outputs.lowercase }}:${{ github.ref_name }}
|
||||
${{ vars.REGISTRY_HOST }}/${{ steps.github_repository_to_lowercase.outputs.lowercase }}:latest
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# 6. (Optional) Clean up local Docker cache
|
||||
# ------------------------------------------------------------------
|
||||
- name: Docker system prune
|
||||
run: docker system prune -f
|
||||
if: ${{ always() }}
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# 7. Output useful info
|
||||
# ------------------------------------------------------------------
|
||||
- name: Show pushed image tags
|
||||
run: |
|
||||
echo "Pushed image tags:"
|
||||
echo "- ${{ vars.REGISTRY_HOST }}/${{ steps.github_repository_to_lowercase.outputs.lowercase }}:${{ github.sha }}"
|
||||
echo "- ${{ vars.REGISTRY_HOST }}/${{ steps.github_repository_to_lowercase.outputs.lowercase }}:${{ github.ref_name }}"
|
||||
echo "- ${{ vars.REGISTRY_HOST }}/${{ steps.github_repository_to_lowercase.outputs.lowercase }}:latest"
|
||||
@@ -0,0 +1,41 @@
|
||||
name: ci
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build_linux:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout source
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Convert to lowercase
|
||||
id: github_repository_to_lowercase
|
||||
run: |
|
||||
# Grab the value (you can also use `${{ github.ref }}`, `${{ secrets.MY_SECRET }}`, etc.)
|
||||
raw_value="${{ github.repository }}"
|
||||
# Convert to lower case
|
||||
lower_value=$(echo "$raw_value" | tr '[:upper:]' '[:lower:]')
|
||||
# Export it to the workflow environment
|
||||
# echo "MY_LOWER=$lower_value" >> $GITHUB_ENV
|
||||
# If you want to use it as an output of this step:
|
||||
echo "lowercase=$lower_value" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build image
|
||||
id: build
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: TinfoilVibeServer/Dockerfile
|
||||
# do not push yet
|
||||
push: false
|
||||
tags: |
|
||||
${{ vars.REGISTRY_HOST }}/${{ steps.github_repository_to_lowercase.outputs.lowercase }}:${{ github.sha }}
|
||||
${{ vars.REGISTRY_HOST }}/${{ steps.github_repository_to_lowercase.outputs.lowercase }}:${{ github.ref_name }}
|
||||
${{ vars.REGISTRY_HOST }}/${{ steps.github_repository_to_lowercase.outputs.lowercase }}:latest
|
||||
build-args: |
|
||||
# Add any build args here
|
||||
# ARG_NAME=VALUE
|
||||
Reference in New Issue
Block a user