chore: add repository config
This commit is contained in:
parent
3beb696eb5
commit
f9d2c80fdb
4 changed files with 216 additions and 1 deletions
64
.forgejo/workflows/publish.yaml
Normal file
64
.forgejo/workflows/publish.yaml
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
name: Publish image
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'boxes/**'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
generate-matrix:
|
||||
name: Generate job matrices
|
||||
runs-on: host
|
||||
outputs:
|
||||
boxes: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||
boxes-count: ${{ steps.changed-files.outputs.all_changed_files_count }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: List changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v45.0.3
|
||||
with:
|
||||
matrix: true
|
||||
diff_relative: true
|
||||
dir_names: true
|
||||
dir_names_exclude_current_dir: true
|
||||
dir_names_max_depth: 2
|
||||
files: boxes/**
|
||||
- name: Output changes
|
||||
run: |
|
||||
echo 'Files changed: ${{ steps.changed-files.outputs.all_changed_files_count }}'
|
||||
echo 'List: ${{ steps.changed-files.outputs.all_changed_files }}'
|
||||
|
||||
create-docker-images:
|
||||
needs: generate-matrix
|
||||
runs-on: host
|
||||
strategy:
|
||||
matrix:
|
||||
box: ${{ fromJson(needs.generate-matrix.outputs.boxes) }}
|
||||
if: ${{ needs.generate-matrix.outputs.boxes-count > 0 }}
|
||||
steps:
|
||||
- name: Print variables
|
||||
run: |
|
||||
echo 'Building image in context: ${{ toJson(matrix) }}'
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.alecodes.page
|
||||
username: ${{ vars.CONTAINER_REGISTRY_USER }}
|
||||
password: ${{ secrets.CONTAINER_REGISTRY_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
context: "{{defaultContext}}:${{ matrix.box }}"
|
||||
tags: |
|
||||
git.alecodes.page/alecodes/devbox:latest
|
||||
Loading…
Add table
Add a link
Reference in a new issue