Skip to content

Commit

Permalink
add container build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
nitwhiz committed Feb 2, 2024
1 parent 685f8d3 commit 7f90b1a
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and Publish

on:
push:
branches:
- main
tags:
- "*"
pull_request:

jobs:
build-and-publish-docker-image:
name: Build docker images and publish
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up docker buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm/v7,linux/arm64

- name: Login to GitHub Packages
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build omnilock image and publish as specific tag
uses: docker/build-push-action@v5
if: ${{ github.ref_type == 'tag' }}
with:
context: ./
tags: "ghcr.io/${{ github.repository }}:${{ github.ref_name }}"
push: true

- name: Build omnilock image and publish as latest
uses: docker/build-push-action@v4
if: ${{ github.ref_type != 'tag' }}
with:
context: ./
tags: "ghcr.io/${{ github.repository }}:latest"
push: ${{ github.ref == 'refs/heads/main' }}

0 comments on commit 7f90b1a

Please sign in to comment.