From 6706f0e6f5c56d3d2cf72945a7e65682b556b340 Mon Sep 17 00:00:00 2001 From: MarkoSagadin Date: Fri, 2 Aug 2024 12:21:02 +0200 Subject: [PATCH] infra: add workflow for building and publishing ncs zephyr images --- .../build-and-publish-ncs-zephyr.yaml | 72 +++++++++++++++++++ .github/workflows/create-release.yaml | 8 ++- 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-and-publish-ncs-zephyr.yaml diff --git a/.github/workflows/build-and-publish-ncs-zephyr.yaml b/.github/workflows/build-and-publish-ncs-zephyr.yaml new file mode 100644 index 0000000..741b5da --- /dev/null +++ b/.github/workflows/build-and-publish-ncs-zephyr.yaml @@ -0,0 +1,72 @@ +name: Build and publish a NCS Zephyr Docker images + +on: + workflow_call: + inputs: + release_version: + required: true + type: string + +env: + REGISTRY: ghcr.io + IMAGE_NAME: irnas/ncs-zephyr + +jobs: + publish: + runs-on: ubuntu-22.04 + + permissions: + contents: read + packages: write + + strategy: + matrix: + variant: + - ncs_version: "v2.2.0" + - ncs_version: "v2.3.0" + - ncs_version: "v2.4.3" + - ncs_version: "v2.5.3" + - ncs_version: "v2.6.1" + - ncs_version: "v2.7.0" + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v3 + + - name: Log into GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{github.actor}} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push CI image + id: push-ci + uses: docker/build-push-action@v5 + with: + file: ./ncs-zephyr/Dockerfile + target: ci + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.variant.ncs_version }}-ci:${{ inputs.release_version }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.variant.ncs_version }}-ci:latest + build-args: | + NCS_SDK_VERSION=${{ matrix.variant.ncs_version }} + + - name: Build and push Dev image + id: push-dev + uses: docker/build-push-action@v5 + with: + file: ./ncs-zephyr/Dockerfile + target: dev + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.variant.ncs_version }}-dev:${{ inputs.release_version }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.variant.ncs_version }}-dev:latest + build-args: | + NCS_SDK_VERSION=${{ matrix.variant.ncs_version }} diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml index de2cf99..613c785 100644 --- a/.github/workflows/create-release.yaml +++ b/.github/workflows/create-release.yaml @@ -63,8 +63,14 @@ jobs: with: release_version: ${{ inputs.version }} - call-build-publish: + call-build-publish-vanilla-zephyr: needs: update-changelog uses: ./.github/workflows/build-and-publish-vanilla-zephyr.yaml with: release_version: ${{ inputs.version }} + + call-build-publish-ncs-zephyr: + needs: update-changelog + uses: ./.github/workflows/build-and-publish-ncs-zephyr.yaml + with: + release_version: ${{ inputs.version }}