Skip to content

Commit

Permalink
Add unified CI workflow
Browse files Browse the repository at this point in the history
This commit adds a new unified CI workflow for building and publishing
the Zephyr SDK build Docker image.

The new unified CI workflow comes with the following changes:

1. Use single workflow for building and publishing Docker image

2. Use the official Docker actions for building and publishing Docker
   image

3. Upload Docker image to both DockerHub and GitHub Container Registry
   (GHCR) such that they are always available from both sources.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
  • Loading branch information
stephanosio committed Mar 29, 2022
1 parent 4cc5212 commit 3f9db27
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI

on:
push:
branches: [ master ]
tags: [ 'v*' ]
pull_request:
branches: [ master ]

permissions:
packages: write

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build
runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Generate metadata
id: meta
uses: docker/metadata-action@v3
with:
images: |
docker.io/zephyrprojectrtos/sdk-build
ghcr.io/zephyrproject-rtos/sdk-build
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 3f9db27

Please sign in to comment.