containers/.forgejo/workflows/ansible.yml

95 lines
2.5 KiB
YAML
Raw Normal View History

2025-07-13 23:49:10 +02:00
run-name: Build and Push Ansible Container
on:
push:
branches:
- main
paths:
- 'containers/${{ github.workflow }}/**'
2025-07-14 00:22:44 +02:00
- 'containers/.forgejo/workflows/ansible.yml'
2025-07-13 23:49:10 +02:00
workflow_dispatch: {}
schedule:
- cron: '0 20 * * 5'
jobs:
build-and-push:
strategy:
matrix:
arch: [ amd64, arm64 ]
runs-on:
- ${{ matrix.arch }}
- docker
2025-07-14 00:03:55 +02:00
container:
2025-07-14 00:22:44 +02:00
image: docker:dind
env:
DOCKER_TLS_CERTDIR: ""
2025-07-13 23:49:10 +02:00
steps:
2025-07-14 00:22:44 +02:00
- name: Install Node.js and dependencies
2025-07-14 00:07:38 +02:00
run: |
apk update
2025-07-14 00:22:44 +02:00
apk add --no-cache nodejs npm git bash
2025-07-14 00:17:03 +02:00
dockerd &
2025-07-14 00:07:38 +02:00
sleep 5
docker version
node --version
npm --version
2025-07-13 23:49:10 +02:00
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Builder
uses: docker/setup-buildx-action@v3
- name: Login to Forgejo Registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.CI_REGISTRY }}
username: ${{ secrets.CI_REGISTRY_USER }}
password: ${{ secrets.CI_TOKEN }}
- name: Set working directory
run: |
cd containers/${{ github.workflow }}/
shell: bash
- name: Build and push (${{ matrix.arch }})
uses: docker/build-push-action@v5
with:
context: containers/${{ github.workflow }}/
file: containers/${{ github.workflow }}/Dockerfile
platforms: linux/${{ matrix.arch }}
push: true
tags: |
${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:${{ matrix.arch }}-latest
manifest:
needs: build-and-push
2025-07-14 00:17:03 +02:00
runs-on: amd64
2025-07-14 00:07:38 +02:00
container:
2025-07-14 00:22:44 +02:00
image: docker:dind
env:
DOCKER_TLS_CERTDIR: ""
2025-07-13 23:49:10 +02:00
steps:
2025-07-14 00:22:44 +02:00
- name: Install Node.js and dependencies
2025-07-14 00:07:38 +02:00
run: |
apk update
2025-07-14 00:22:44 +02:00
apk add --no-cache nodejs npm git bash
2025-07-14 00:17:03 +02:00
dockerd &
2025-07-14 00:07:38 +02:00
sleep 5
docker version
node --version
npm --version
2025-07-13 23:49:10 +02:00
- name: Login to Forgejo Registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.CI_REGISTRY }}
username: ${{ secrets.CI_REGISTRY_USER }}
password: ${{ secrets.CI_TOKEN }}
- name: Create and push multi-arch manifest
run: |
docker manifest create ${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:latest \
${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:amd64-latest \
${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:arm64-latest
docker manifest push ${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:latest