turbopilot/.github/workflows/docker-image.yml

70 lines
1.9 KiB
YAML
Raw Normal View History

2023-04-10 04:02:57 -04:00
name: Docker Image CI
on:
push:
branches: [ "main" ]
2023-04-14 03:39:03 -04:00
tags: ['*']
2023-04-10 04:02:57 -04:00
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
2023-04-10 04:05:55 -04:00
- name: Checkout
2023-04-13 03:20:26 -04:00
uses: actions/checkout@v3
2023-04-10 04:09:10 -04:00
with:
submodules: true
2023-04-10 04:07:53 -04:00
2023-04-13 03:16:35 -04:00
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
2023-04-13 03:20:26 -04:00
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
2023-04-13 03:16:35 -04:00
2023-04-13 03:20:26 -04:00
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v2
with:
2023-04-14 01:53:16 -04:00
platforms: linux/amd64,linux/arm64,linux/arm68/v8
2023-04-13 03:16:35 -04:00
- name: Login to GH ContainerHub
uses: docker/login-action@v2
2023-04-10 04:02:57 -04:00
with:
2023-04-13 03:16:35 -04:00
registry: ghcr.io
username: ravenscroftj
password: ${{ secrets.GH_TOKEN }}
2023-04-14 03:34:10 -04:00
- name: Build and push incremental
2023-04-13 03:16:35 -04:00
uses: docker/build-push-action@v4
2023-04-14 03:34:10 -04:00
if: (!startsWith(github.ref, 'refs/tags/'))
2023-04-13 03:16:35 -04:00
with:
push: true
2023-04-14 03:34:10 -04:00
tags: ghcr.io/ravenscroftj/turbopilot:latest
context: ${{github.workspace}}
platforms: linux/amd64,linux/arm64
- name: Build and push release
uses: docker/build-push-action@v4
2023-04-14 03:44:50 -04:00
if: startsWith(github.ref, 'refs/tags/')
2023-04-14 03:34:10 -04:00
with:
push: true
2023-04-14 03:44:50 -04:00
tags: ghcr.io/ravenscroftj/turbopilot:${{ github.ref }}
2023-04-13 03:22:35 -04:00
context: ${{github.workspace}}
2023-04-13 03:25:09 -04:00
platforms: linux/amd64,linux/arm64
2023-04-13 03:16:35 -04:00
# - name: Publish Docker Image to GitHub Registry
# # You may pin to the exact commit or the version.
# # uses: TilBlechschmidt/gp-docker-action@f89287d44556dd7d24f76c799cd0795eeb352bcf
# uses: TilBlechschmidt/gp-docker-action@v0.2-alpha
# with:
# # GitHub token to push Docker image to GitHub Packages
# github-token: ${{ secrets.GH_TOKEN }}
# # Docker Image name
# image-name: turbopilot
# # Path to the directory where the Dockerfile resides
# dockerfile-path: . # optional, default is .