run-name: Build and Push Ansible Container on: push: branches: - main paths: - 'containers/${{ github.workflow }}/**' - '.forgejo/workflows/ansible.yml' workflow_dispatch: {} schedule: - cron: '0 20 * * 5' jobs: build-and-push: strategy: matrix: arch: [ amd64, arm64 ] runs-on: - ${{ matrix.arch }} - docker container: image: docker:dind steps: - name: Install Node.js and dependencies run: | apk update apk add --no-cache nodejs npm git bash - 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 runs-on: amd64 container: image: docker:dind steps: - name: Install Node.js and dependencies run: | apk update apk add --no-cache nodejs npm git bash - 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