Set up github actions #13
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: moma CD | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
env: | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: ghcr.io | |
# github.repository as <account>/<repo> | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-dockers: | |
name: Build docker images | |
strategy: | |
matrix: | |
dockerfile: [dev, robot, demo] | |
runs-on: self-hosted | |
steps: | |
- name: Fix other git issues | |
run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- name: Check out moma repo | |
uses: actions/checkout@v3 | |
with: | |
path: moma_ws/src/moma | |
- name: Workaround for older git client on self-hosted runners | |
run: | | |
ls | |
pwd | |
cd moma_ws/src/moma | |
ls | |
git submodule update --init --recursive | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log into registry ${{ env.REGISTRY }} | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: type=raw,value=${{ matrix.dockerfile }} | |
- name: Build and push docker | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./moma_ws/src/moma/docker/ | |
file: ./moma_ws/src/moma/docker/${{ matrix.dockerfile }}.Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |