bot-api/.gitea/workflows/build.yaml

62 lines
1.9 KiB
YAML
Raw Normal View History

2024-01-07 11:54:46 +00:00
name: Test via test action and then build image
on:
push:
branches:
- main
- develop
jobs:
unit-test:
2024-01-07 11:58:32 +00:00
container:
2024-01-07 12:15:08 +00:00
image: docker:dind
2024-01-07 11:54:46 +00:00
steps:
2024-01-07 12:15:08 +00:00
- name: Installing necessary packages
run: apk add nodejs git curl bash
2024-01-07 11:59:42 +00:00
- name: Checkout
2024-01-07 12:12:19 +00:00
uses: actions/checkout@v3
- name: Run test job
2024-01-07 11:58:32 +00:00
uses: ./.gitea/workflows/test.yaml
2024-01-07 11:54:46 +00:00
build:
container:
2024-01-07 12:15:08 +00:00
image: docker:dind
2024-01-07 11:54:46 +00:00
needs: unit-test
steps:
2024-01-07 12:15:08 +00:00
- name: Installing necessary packages
run: apk add nodejs git curl bash
2024-01-07 11:54:46 +00:00
- name: Checkout
2024-01-07 12:12:19 +00:00
uses: actions/checkout@v3
2024-01-07 11:54:46 +00:00
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
fedi-image-bot/bot-api
2024-01-07 12:12:19 +00:00
git.fai.st/fedi-image-bot/bot-api
2024-01-07 11:54:46 +00:00
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
2024-01-07 12:12:19 +00:00
type=sha
2024-01-07 11:54:46 +00:00
- name: Set up QEMU
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to fai.st docker registry
uses: docker/login-action@v3
with:
registry: git.fai.st
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Build and push
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=fedi-image-bot/bot-api:latest
2024-01-07 12:12:19 +00:00
cache-to: type=inline