2020-12-03 11:34:06 +01:00
|
|
|
name: Containers
|
|
|
|
|
|
|
|
env:
|
2022-10-08 07:56:49 +02:00
|
|
|
zephyr-version: 3.2.0
|
2022-12-23 08:19:01 +01:00
|
|
|
zephyr-sdk-version: 0.15.2
|
2021-05-25 20:29:17 +02:00
|
|
|
sha-abbrev-length: 12
|
2021-06-12 23:34:59 +02:00
|
|
|
no-cache: ${{ secrets.NO_CACHE != null || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}
|
2021-06-13 13:59:40 +02:00
|
|
|
ignore-actions-cache: ${{ secrets.IGNORE_ACTIONS_CACHE != null }}
|
2021-05-19 12:17:32 +02:00
|
|
|
run-unit-tests: ${{ secrets.RUN_UNIT_TESTS != null }}
|
2021-05-19 21:36:30 +02:00
|
|
|
docker-hub-credentials: ${{ secrets.DOCKER_HUB_USERNAME != null && secrets.DOCKER_HUB_TOKEN != null }}
|
|
|
|
ghcr-credentials: ${{ secrets.GHCR_USERNAME != null && secrets.GHCR_TOKEN != null }}
|
2023-07-21 10:44:19 +02:00
|
|
|
gitea-credentials: ${{ secrets.GITEA_USERNAME != null && secrets.GITEA_TOKEN != null }}
|
2021-05-19 20:53:17 +02:00
|
|
|
docker-hub-namespace: ${{ secrets.DOCKER_HUB_NAMESPACE || github.repository_owner }}
|
2021-06-08 20:10:50 +02:00
|
|
|
docker-hub-namespace-upstream: ${{ secrets.DOCKER_HUB_NAMESPACE_UPSTREAM || 'zmkfirmware' }}
|
2021-05-19 20:53:17 +02:00
|
|
|
ghcr-namespace: ${{ github.repository_owner }}
|
2021-05-19 12:17:32 +02:00
|
|
|
zmk-repository: ${{ secrets.ZMK_REPOSITORY || 'zmkfirmware/zmk' }}
|
|
|
|
zmk-ref: ${{ secrets.ZMK_REF || 'main' }}
|
2020-12-03 11:34:06 +01:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request:
|
|
|
|
workflow_dispatch:
|
2021-06-09 21:19:49 +02:00
|
|
|
schedule:
|
|
|
|
- cron: '0 2 * * *' # every day at 02:00 UTC
|
2020-12-03 11:34:06 +01:00
|
|
|
|
2021-05-16 16:48:35 +02:00
|
|
|
concurrency: ${{ github.ref }}/${{ github.workflow }}
|
|
|
|
|
2020-12-03 11:34:06 +01:00
|
|
|
jobs:
|
2021-06-13 18:51:45 +02:00
|
|
|
timestamp:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
timestamp: ${{ steps.timestamp.outputs.timestamp }}
|
|
|
|
steps:
|
|
|
|
- name: Timestamp
|
|
|
|
id: timestamp
|
2022-10-29 18:01:10 +02:00
|
|
|
run: echo "timestamp=$(date +%Y%m%d%H%M%S)" >> $GITHUB_OUTPUT
|
2021-05-14 20:12:34 +02:00
|
|
|
architectures:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
json: ${{ steps.import.outputs.json }}
|
|
|
|
steps:
|
2022-10-29 18:01:10 +02:00
|
|
|
- name: Install yaml2json
|
2023-07-21 10:48:50 +02:00
|
|
|
run: pip3 install remarshal
|
2021-05-14 20:12:34 +02:00
|
|
|
- name: Checkout
|
2022-11-03 16:36:37 +01:00
|
|
|
uses: actions/checkout@v3
|
2021-05-14 20:12:34 +02:00
|
|
|
- name: Import from architectures.yml
|
|
|
|
id: import
|
2022-10-29 18:01:10 +02:00
|
|
|
run: echo "json=$(yaml2json architectures.yml | jq -c .)" >> $GITHUB_OUTPUT
|
2021-05-14 20:12:34 +02:00
|
|
|
tags:
|
2021-06-13 18:51:45 +02:00
|
|
|
needs:
|
|
|
|
- timestamp
|
2021-05-14 20:12:34 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
2021-05-19 12:00:07 +02:00
|
|
|
branch: ${{ steps.definitions.outputs.branch }}
|
2021-06-08 21:35:10 +02:00
|
|
|
base: ${{ steps.definitions.outputs.base }}
|
2021-05-14 20:12:34 +02:00
|
|
|
candidate: ${{ steps.definitions.outputs.candidate }}
|
2021-06-12 11:09:04 +02:00
|
|
|
versions: ${{ steps.definitions.outputs.versions }} # e.g. 2.4.0-0.11.4
|
|
|
|
major-minor: ${{ steps.definitions.outputs.major-minor }} # e.g. 2.4
|
|
|
|
major-minor-branch: ${{ steps.definitions.outputs.major-minor-branch }} # e.g. 2.4-branch
|
2021-05-14 20:12:34 +02:00
|
|
|
steps:
|
|
|
|
- name: Definitions
|
|
|
|
id: definitions
|
|
|
|
env:
|
2021-06-13 18:51:45 +02:00
|
|
|
TIMESTAMP: ${{ needs.timestamp.outputs.timestamp }}
|
2021-05-14 20:12:34 +02:00
|
|
|
SHA: ${{ github.sha }}
|
2021-05-25 20:29:17 +02:00
|
|
|
SHA_ABBREV_LENGTH: ${{ env.sha-abbrev-length }}
|
|
|
|
RUN_ID: ${{ github.run_id }}
|
2021-05-14 20:12:34 +02:00
|
|
|
ZEPHYR_VERSION: ${{ env.zephyr-version }}
|
|
|
|
ZEPHYR_SDK_VERSION: ${{ env.zephyr-sdk-version }}
|
|
|
|
run: |
|
2021-05-19 12:00:07 +02:00
|
|
|
BRANCH=${GITHUB_REF#refs/heads/}
|
|
|
|
BRANCH=${BRANCH//[^A-Za-z0-9_.-]/_} # Substitutes invalid Docker tag characters
|
2021-06-08 21:35:10 +02:00
|
|
|
BASE=${GITHUB_BASE_REF//[^A-Za-z0-9_.-]/_} # Substitutes invalid Docker tag characters
|
2021-05-25 20:29:17 +02:00
|
|
|
SHA=${SHA:0:${SHA_ABBREV_LENGTH}}
|
2021-06-13 18:51:45 +02:00
|
|
|
CANDIDATE=${BRANCH}-${TIMESTAMP}-${ZEPHYR_VERSION}-${ZEPHYR_SDK_VERSION}-${SHA}-${RUN_ID}
|
2021-05-14 20:12:34 +02:00
|
|
|
VERSIONS=${ZEPHYR_VERSION}-${ZEPHYR_SDK_VERSION}
|
|
|
|
MAJOR=$(echo ${ZEPHYR_VERSION} | cut -d'.' -f 1)
|
|
|
|
MINOR=$(echo ${ZEPHYR_VERSION} | cut -d'.' -f 2)
|
|
|
|
MAJOR_MINOR=${MAJOR}.${MINOR}
|
2021-06-10 15:12:18 +02:00
|
|
|
MAJOR_MINOR_BRANCH=${MAJOR_MINOR}-branch
|
2021-05-14 20:12:34 +02:00
|
|
|
|
2022-10-29 18:01:10 +02:00
|
|
|
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
|
|
|
|
echo "base=${BASE}" >> $GITHUB_OUTPUT
|
|
|
|
echo "candidate=${CANDIDATE}" >> $GITHUB_OUTPUT
|
|
|
|
echo "versions=${VERSIONS}" >> $GITHUB_OUTPUT
|
|
|
|
echo "major-minor=${MAJOR_MINOR}" >> $GITHUB_OUTPUT
|
|
|
|
echo "major-minor-branch=${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
|
2021-06-09 15:26:45 +02:00
|
|
|
dev-generic:
|
|
|
|
needs:
|
2021-06-12 22:52:10 +02:00
|
|
|
- timestamp
|
2021-06-09 15:26:45 +02:00
|
|
|
- tags
|
|
|
|
if: ${{ !startsWith(github.ref, 'refs/tags') }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
id: docker-hub-login
|
|
|
|
if: ${{ env.docker-hub-credentials == 'true' }}
|
2022-10-28 19:19:40 +02:00
|
|
|
uses: docker/login-action@v2
|
2021-06-09 15:26:45 +02:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
id: ghcr-login
|
|
|
|
if: ${{ env.ghcr-credentials == 'true' }}
|
2022-10-28 19:19:40 +02:00
|
|
|
uses: docker/login-action@v2
|
2021-06-09 15:26:45 +02:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ secrets.GHCR_USERNAME }}
|
|
|
|
password: ${{ secrets.GHCR_TOKEN }}
|
2023-07-21 10:44:19 +02:00
|
|
|
- name: Login to Gitea
|
|
|
|
id: docker-hub-login
|
|
|
|
if: ${{ env.gitea-credentials == 'true' }}
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
registry: git.sporq.de
|
|
|
|
username: ${{ secrets.GITEA_USERNAME }}
|
|
|
|
password: ${{ secrets.GITEA_TOKEN }}
|
2021-06-09 15:26:45 +02:00
|
|
|
- name: Define paths
|
|
|
|
id: paths
|
|
|
|
env:
|
|
|
|
NS: ${{ env.docker-hub-namespace }}
|
2021-06-08 20:10:50 +02:00
|
|
|
NSU: ${{ env.docker-hub-namespace-upstream }}
|
2021-06-12 21:54:47 +02:00
|
|
|
REPOSITORY: zmk-dev-generic
|
2021-06-09 15:26:45 +02:00
|
|
|
BRANCH: ${{ needs.tags.outputs.branch }}
|
|
|
|
BASE: ${{ needs.tags.outputs.base }}
|
2021-06-10 15:12:18 +02:00
|
|
|
MAJOR_MINOR_BRANCH: ${{ needs.tags.outputs.major-minor-branch }}
|
2021-06-09 15:26:45 +02:00
|
|
|
run: |
|
2022-10-29 18:01:10 +02:00
|
|
|
echo "local=/tmp/.buildx/dev-generic" >> $GITHUB_OUTPUT
|
|
|
|
echo "local-new=/tmp/.buildx/dev-generic-new" >> $GITHUB_OUTPUT
|
|
|
|
echo "branch=docker.io/${NS}/${REPOSITORY}:${BRANCH}" >> $GITHUB_OUTPUT
|
2021-06-09 15:26:45 +02:00
|
|
|
if [ ! -z "$BASE" ]; then
|
2022-10-29 18:01:10 +02:00
|
|
|
echo "base=docker.io/${NS}/${REPOSITORY}:${BASE}" >> $GITHUB_OUTPUT
|
2021-06-09 15:26:45 +02:00
|
|
|
fi
|
2022-10-29 18:01:10 +02:00
|
|
|
echo "major-minor-branch=docker.io/${NS}/${REPOSITORY}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
|
|
|
|
echo "branch-upstream=docker.io/${NSU}/${REPOSITORY}:${BRANCH}" >> $GITHUB_OUTPUT
|
|
|
|
echo "major-minor-branch-upstream=docker.io/${NSU}/${REPOSITORY}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
|
2021-06-09 15:26:45 +02:00
|
|
|
- name: Set up cache
|
|
|
|
id: cache
|
2022-10-28 19:19:40 +02:00
|
|
|
uses: actions/cache@v3
|
2021-06-09 15:26:45 +02:00
|
|
|
env:
|
|
|
|
cache-name: dev-generic
|
|
|
|
with:
|
|
|
|
path: ${{ steps.paths.outputs.local }}
|
2021-06-12 22:52:10 +02:00
|
|
|
key: ${{ runner.os }}/${{ env.cache-name }}/${{ github.run_id }}/${{ needs.timestamp.outputs.timestamp }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}/${{ env.cache-name }}/${{ github.run_id }}
|
2021-06-09 15:26:45 +02:00
|
|
|
- name: Set up QEMU
|
2022-10-28 19:19:40 +02:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2021-06-09 15:26:45 +02:00
|
|
|
- name: Set up Docker Buildx
|
2022-10-28 20:06:14 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2021-06-09 15:26:45 +02:00
|
|
|
- name: Build to local cache
|
2022-10-28 19:19:40 +02:00
|
|
|
uses: docker/build-push-action@v3
|
2021-06-09 15:26:45 +02:00
|
|
|
with:
|
|
|
|
target: dev-generic
|
2022-01-27 20:51:19 +01:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2021-06-09 15:26:45 +02:00
|
|
|
build-args: |
|
|
|
|
ZEPHYR_VERSION=${{ env.zephyr-version }}
|
2021-06-12 15:14:41 +02:00
|
|
|
no-cache: ${{ env.no-cache == 'true' }}
|
2021-06-09 15:26:45 +02:00
|
|
|
cache-from: |
|
2021-06-13 13:59:40 +02:00
|
|
|
${{ (env.ignore-actions-cache == 'false') && format('type=local,src={0}', steps.paths.outputs.local) || '' }}
|
2021-06-09 15:26:45 +02:00
|
|
|
type=registry,ref=${{ steps.paths.outputs.branch }}
|
|
|
|
${{ (steps.paths.outputs.base != '') && format('type=registry,ref={0}', steps.paths.outputs.base) || '' }}
|
2021-06-10 15:12:18 +02:00
|
|
|
type=registry,ref=${{ steps.paths.outputs.major-minor-branch }}
|
2021-06-08 20:10:50 +02:00
|
|
|
type=registry,ref=${{ steps.paths.outputs.branch-upstream }}
|
2021-06-10 15:12:18 +02:00
|
|
|
type=registry,ref=${{ steps.paths.outputs.major-minor-branch-upstream }}
|
2021-06-09 15:26:45 +02:00
|
|
|
cache-to: type=local,dest=${{ steps.paths.outputs.local-new }},mode=max
|
|
|
|
- name: Push to registry cache
|
2021-06-12 22:52:10 +02:00
|
|
|
if: ${{ env.docker-hub-credentials == 'true' }}
|
2022-10-28 19:19:40 +02:00
|
|
|
uses: docker/build-push-action@v3
|
2021-06-09 15:26:45 +02:00
|
|
|
with:
|
|
|
|
target: dev-generic
|
2022-01-27 20:51:19 +01:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2021-06-09 15:26:45 +02:00
|
|
|
build-args: |
|
|
|
|
ZEPHYR_VERSION=${{ env.zephyr-version }}
|
2021-06-12 21:54:47 +02:00
|
|
|
tags: |
|
|
|
|
${{ steps.paths.outputs.branch }}
|
2021-06-09 15:26:45 +02:00
|
|
|
cache-from: type=local,src=${{ steps.paths.outputs.local-new }}
|
2021-06-12 21:54:47 +02:00
|
|
|
cache-to: type=inline
|
|
|
|
push: true
|
2021-06-09 15:26:45 +02:00
|
|
|
# Workaround to stop the dev-generic cache ballooning ...
|
|
|
|
# https://github.com/docker/build-push-action/issues/252
|
|
|
|
# https://github.com/moby/buildkit/issues/1896
|
|
|
|
- name: Switch local cache
|
|
|
|
run: |
|
|
|
|
rm -rf ${{ steps.paths.outputs.local }}
|
|
|
|
mv ${{ steps.paths.outputs.local-new }} ${{ steps.paths.outputs.local }}
|
2021-05-14 20:12:34 +02:00
|
|
|
candidates:
|
2021-05-14 20:12:34 +02:00
|
|
|
needs:
|
2021-06-12 22:52:10 +02:00
|
|
|
- timestamp
|
2021-05-14 20:12:34 +02:00
|
|
|
- architectures
|
2021-05-14 20:12:34 +02:00
|
|
|
- tags
|
2021-06-09 15:26:45 +02:00
|
|
|
- dev-generic
|
2021-05-14 20:12:34 +02:00
|
|
|
if: ${{ !startsWith(github.ref, 'refs/tags') }}
|
2020-12-03 11:34:06 +01:00
|
|
|
runs-on: ubuntu-latest
|
2021-05-19 12:17:32 +02:00
|
|
|
env:
|
|
|
|
docker-args: --rm --workdir /github/workspace -v /var/run/docker.sock:/var/run/docker.sock -v /home/runner/work/_temp:/home/runner/work/_temp -v /home/runner/work/_temp/_github_home:/github/home -v /home/runner/work/_temp/_github_workflow:/github/workflow -v /home/runner/work/_temp/_runner_file_commands:/github/file_commands -v ${{ github.workspace }}:/github/workspace
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: /usr/bin/docker exec candidate /bin/bash {0}
|
2020-12-03 11:34:06 +01:00
|
|
|
strategy:
|
2021-05-18 20:55:55 +02:00
|
|
|
fail-fast: false
|
2021-05-14 20:12:34 +02:00
|
|
|
matrix:
|
|
|
|
architecture: ${{ fromJSON(needs.architectures.outputs.json) }}
|
2021-05-19 12:17:32 +02:00
|
|
|
include:
|
|
|
|
- architecture: arm
|
|
|
|
board: nice_nano
|
|
|
|
shield: qaz
|
2020-12-03 11:34:06 +01:00
|
|
|
steps:
|
2021-05-14 20:12:34 +02:00
|
|
|
- name: Login to Docker Hub
|
|
|
|
id: docker-hub-login
|
2021-05-19 21:36:30 +02:00
|
|
|
if: ${{ env.docker-hub-credentials == 'true' }}
|
2022-10-28 19:19:40 +02:00
|
|
|
uses: docker/login-action@v2
|
2021-05-14 20:12:34 +02:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
2020-12-03 11:34:06 +01:00
|
|
|
- name: Login to GitHub Container Registry
|
2021-05-11 23:03:46 +02:00
|
|
|
id: ghcr-login
|
2021-05-19 21:36:30 +02:00
|
|
|
if: ${{ env.ghcr-credentials == 'true' }}
|
2022-10-28 19:19:40 +02:00
|
|
|
uses: docker/login-action@v2
|
2020-12-03 11:34:06 +01:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ secrets.GHCR_USERNAME }}
|
|
|
|
password: ${{ secrets.GHCR_TOKEN }}
|
2023-07-21 10:44:19 +02:00
|
|
|
- name: Login to Gitea
|
|
|
|
id: docker-hub-login
|
|
|
|
if: ${{ env.gitea-credentials == 'true' }}
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
registry: git.sporq.de
|
|
|
|
username: ${{ secrets.GITEA_USERNAME }}
|
|
|
|
password: ${{ secrets.GITEA_TOKEN }}
|
2021-05-22 16:04:22 +02:00
|
|
|
- name: Define repositories
|
|
|
|
id: repositories
|
2021-05-19 12:17:32 +02:00
|
|
|
shell: bash
|
2021-05-22 16:04:22 +02:00
|
|
|
run: |
|
2022-10-29 18:01:10 +02:00
|
|
|
echo "build=zmk-build-${{ matrix.architecture }}" >> $GITHUB_OUTPUT
|
|
|
|
echo "dev=zmk-dev-${{ matrix.architecture }}" >> $GITHUB_OUTPUT
|
2021-05-22 17:14:08 +02:00
|
|
|
- name: Define paths
|
|
|
|
id: paths
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
NS: ${{ env.docker-hub-namespace }}
|
2021-06-08 20:10:50 +02:00
|
|
|
NSU: ${{ env.docker-hub-namespace-upstream }}
|
2021-05-22 17:14:08 +02:00
|
|
|
BUILD: ${{ steps.repositories.outputs.build }}
|
|
|
|
DEV: ${{ steps.repositories.outputs.dev }}
|
|
|
|
CANDIDATE: ${{ needs.tags.outputs.candidate }}
|
|
|
|
BRANCH: ${{ needs.tags.outputs.branch }}
|
2021-06-08 21:35:10 +02:00
|
|
|
BASE: ${{ needs.tags.outputs.base }}
|
2021-06-10 15:12:18 +02:00
|
|
|
MAJOR_MINOR_BRANCH: ${{ needs.tags.outputs.major-minor-branch }}
|
2021-05-22 17:14:08 +02:00
|
|
|
run: |
|
2022-10-29 18:01:10 +02:00
|
|
|
echo "dev-generic=/tmp/.buildx/dev-generic" >> $GITHUB_OUTPUT
|
|
|
|
echo "build-candidate=docker.io/${NS}/${BUILD}:${CANDIDATE}" >> $GITHUB_OUTPUT
|
|
|
|
echo "build-branch=docker.io/${NS}/${BUILD}:${BRANCH}" >> $GITHUB_OUTPUT
|
2021-06-08 21:35:10 +02:00
|
|
|
if [ ! -z "$BASE" ]; then
|
2022-10-29 18:01:10 +02:00
|
|
|
echo "build-base=docker.io/${NS}/${BUILD}:${BASE}" >> $GITHUB_OUTPUT
|
2021-06-08 21:35:10 +02:00
|
|
|
fi
|
2022-10-29 18:01:10 +02:00
|
|
|
echo "build-major-minor-branch=docker.io/${NS}/${BUILD}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
|
|
|
|
echo "build-branch-upstream=docker.io/${NSU}/${BUILD}:${BRANCH}" >> $GITHUB_OUTPUT
|
|
|
|
echo "build-major-minor-branch-upstream=docker.io/${NSU}/${BUILD}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
|
|
|
|
echo "dev-candidate=docker.io/${NS}/${DEV}:${CANDIDATE}" >> $GITHUB_OUTPUT
|
|
|
|
echo "dev-branch=docker.io/${NS}/${DEV}:${BRANCH}" >> $GITHUB_OUTPUT
|
2021-06-08 21:35:10 +02:00
|
|
|
if [ ! -z "$BASE" ]; then
|
2022-10-29 18:01:10 +02:00
|
|
|
echo "dev-base=docker.io/${NS}/${DEV}:${BASE}" >> $GITHUB_OUTPUT
|
2021-06-08 21:35:10 +02:00
|
|
|
fi
|
2022-10-29 18:01:10 +02:00
|
|
|
echo "dev-major-minor-branch=docker.io/${NS}/${DEV}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
|
|
|
|
echo "dev-branch-upstream=docker.io/${NSU}/${DEV}:${BRANCH}" >> $GITHUB_OUTPUT
|
|
|
|
echo "dev-major-minor-branch-upstream=docker.io/${NSU}/${DEV}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
|
2021-05-23 12:21:48 +02:00
|
|
|
- name: Define build-args
|
|
|
|
id: build-args
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
LIST="
|
|
|
|
ZEPHYR_VERSION=${{ env.zephyr-version }}
|
|
|
|
ARCHITECTURE=${{ matrix.architecture }}
|
|
|
|
ZEPHYR_SDK_VERSION=${{ env.zephyr-sdk-version }}
|
|
|
|
"
|
2022-10-29 18:01:10 +02:00
|
|
|
|
|
|
|
delimiter="$(openssl rand -hex 8)"
|
|
|
|
echo "list<<${delimiter}" >> $GITHUB_OUTPUT
|
|
|
|
echo "${LIST}" >> $GITHUB_OUTPUT
|
|
|
|
echo "${delimiter}" >> $GITHUB_OUTPUT
|
2021-05-23 12:21:48 +02:00
|
|
|
- name: Define labels
|
|
|
|
id: labels
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
LIST="
|
|
|
|
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
|
|
|
|
org.opencontainers.image.revision=${{ github.sha }}
|
|
|
|
"
|
2022-10-29 18:01:10 +02:00
|
|
|
delimiter="$(openssl rand -hex 8)"
|
|
|
|
|
|
|
|
echo "list<<${delimiter}" >> $GITHUB_OUTPUT
|
|
|
|
echo "${LIST}" >> $GITHUB_OUTPUT
|
|
|
|
echo "${delimiter}" >> $GITHUB_OUTPUT
|
2021-06-09 15:26:45 +02:00
|
|
|
- name: Set up dev-generic cache
|
|
|
|
id: dev-generic-cache
|
2022-10-28 19:19:40 +02:00
|
|
|
uses: actions/cache@v3
|
2021-06-09 15:26:45 +02:00
|
|
|
env:
|
|
|
|
cache-name: dev-generic
|
|
|
|
with:
|
|
|
|
path: ${{ steps.paths.outputs.dev-generic }}
|
2021-06-12 22:52:10 +02:00
|
|
|
key: ${{ runner.os }}/${{ env.cache-name }}/${{ github.run_id }}/${{ needs.timestamp.outputs.timestamp }}
|
2020-12-03 11:34:06 +01:00
|
|
|
- name: Set up QEMU
|
2022-10-28 19:19:40 +02:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2020-12-03 11:34:06 +01:00
|
|
|
- name: Set up Docker Buildx
|
2022-10-28 20:06:14 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2021-05-23 12:21:48 +02:00
|
|
|
- name: Build and load 'build' candidate image
|
2022-10-28 19:19:40 +02:00
|
|
|
uses: docker/build-push-action@v3
|
2020-12-03 11:34:06 +01:00
|
|
|
with:
|
2021-05-23 12:21:48 +02:00
|
|
|
target: build
|
2020-12-03 11:34:06 +01:00
|
|
|
build-args: |
|
2021-05-23 12:21:48 +02:00
|
|
|
${{ steps.build-args.outputs.list }}
|
2021-05-09 21:50:17 +02:00
|
|
|
labels: |
|
2021-05-23 12:21:48 +02:00
|
|
|
${{ steps.labels.outputs.list }}
|
2020-12-03 11:34:06 +01:00
|
|
|
tags: |
|
2021-05-23 12:21:48 +02:00
|
|
|
${{ steps.paths.outputs.build-candidate }}
|
|
|
|
${{ steps.paths.outputs.build-branch }}
|
2021-05-22 16:04:22 +02:00
|
|
|
cache-from: |
|
2021-06-09 15:26:45 +02:00
|
|
|
type=local,src=${{ steps.paths.outputs.dev-generic }}
|
2021-06-12 15:14:41 +02:00
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-candidate) }}
|
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-branch) }}
|
|
|
|
${{ (env.no-cache == 'false') && (steps.paths.outputs.build-base != '') && format('type=registry,ref={0}', steps.paths.outputs.build-base) || '' }}
|
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-major-minor-branch) }}
|
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-branch-upstream) }}
|
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-major-minor-branch-upstream) }}
|
2021-05-23 12:21:48 +02:00
|
|
|
cache-to: type=inline
|
|
|
|
load: true
|
|
|
|
- name: Build and load 'dev' candidate image
|
2022-10-28 19:19:40 +02:00
|
|
|
uses: docker/build-push-action@v3
|
2021-05-23 12:21:48 +02:00
|
|
|
with:
|
|
|
|
target: dev
|
|
|
|
build-args: |
|
|
|
|
${{ steps.build-args.outputs.list }}
|
|
|
|
labels: |
|
|
|
|
${{ steps.labels.outputs.list }}
|
|
|
|
tags: |
|
|
|
|
${{ steps.paths.outputs.dev-candidate }}
|
|
|
|
${{ steps.paths.outputs.dev-branch }}
|
|
|
|
cache-from: |
|
|
|
|
type=registry,ref=${{ steps.paths.outputs.build-candidate }}
|
2021-06-09 15:26:45 +02:00
|
|
|
type=local,src=${{ steps.paths.outputs.dev-generic }}
|
2021-06-12 15:14:41 +02:00
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-candidate) }}
|
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-branch) }}
|
|
|
|
${{ (env.no-cache == 'false') && (steps.paths.outputs.dev-base != '') && format('type=registry,ref={0}', steps.paths.outputs.dev-base) || '' }}
|
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-major-minor-branch) }}
|
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-branch-upstream) }}
|
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-major-minor-branch-upstream) }}
|
2021-05-22 16:04:22 +02:00
|
|
|
cache-to: type=inline
|
2021-05-19 12:17:32 +02:00
|
|
|
load: true
|
|
|
|
- name: Checkout ZMK
|
2022-11-03 16:36:37 +01:00
|
|
|
uses: actions/checkout@v3
|
2021-05-19 12:17:32 +02:00
|
|
|
with:
|
|
|
|
repository: ${{ env.zmk-repository }}
|
|
|
|
ref: ${{ env.zmk-ref }}
|
|
|
|
- name: Cache Zephyr modules
|
2022-10-28 19:19:40 +02:00
|
|
|
uses: actions/cache@v3
|
2021-05-19 12:17:32 +02:00
|
|
|
env:
|
|
|
|
cache-name: zephyr-modules
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
modules/
|
|
|
|
tools/
|
|
|
|
zephyr/
|
|
|
|
bootloader/
|
|
|
|
key: ${{ runner.os }}/${{ env.cache-name }}/${{ hashFiles('app/west.yml') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}/${{ env.cache-name }}/
|
2021-05-23 12:21:48 +02:00
|
|
|
- name: Create and run container from 'build' candidate image
|
|
|
|
shell: bash
|
|
|
|
run: docker run -d -it --name candidate ${{ env.docker-args }} ${{ steps.paths.outputs.build-candidate }}
|
2022-10-08 09:26:35 +02:00
|
|
|
- name: Fixes for git safety checks
|
|
|
|
run: git config --global --add safe.directory '*'
|
2021-06-10 21:23:56 +02:00
|
|
|
- name: Test cmake
|
|
|
|
run: cmake --version
|
2021-06-10 22:01:07 +02:00
|
|
|
- name: Test python
|
|
|
|
run: python3 --version
|
2021-05-19 12:17:32 +02:00
|
|
|
- name: Test diff
|
|
|
|
run: diff --version
|
|
|
|
- name: Test west init
|
|
|
|
run: west init -l app
|
|
|
|
- name: Test west update
|
|
|
|
run: west update
|
|
|
|
- name: Test west zephyr-export
|
|
|
|
run: west zephyr-export
|
|
|
|
- name: Test board/shield (west build)
|
2021-05-20 17:42:17 +02:00
|
|
|
id: board-shield
|
2021-05-19 12:17:32 +02:00
|
|
|
if: ${{ matrix.board != null }}
|
|
|
|
run: west build -s app -b ${{ matrix.board }} -- ${{ matrix.shield != null && format('-DSHIELD={0}', matrix.shield) || null }}
|
|
|
|
- name: Test RAM report (west build)
|
2021-05-20 17:42:17 +02:00
|
|
|
if: ${{ steps.board-shield.outcome == 'success' }}
|
2021-05-19 12:17:32 +02:00
|
|
|
run: west build -t ram_report
|
|
|
|
- name: Test ROM report (west build)
|
2021-05-20 17:42:17 +02:00
|
|
|
if: ${{ steps.board-shield.outcome == 'success' }}
|
2021-05-19 12:17:32 +02:00
|
|
|
run: west build -t rom_report
|
|
|
|
- name: Test west test (single)
|
|
|
|
run: west test tests/none/normal
|
|
|
|
- name: Test west test (full)
|
|
|
|
if: ${{ env.run-unit-tests == 'true' }}
|
|
|
|
run: west test
|
|
|
|
- name: Test clean (west build)
|
2021-05-20 17:42:17 +02:00
|
|
|
if: ${{ steps.board-shield.outcome == 'success' }}
|
2021-05-19 12:17:32 +02:00
|
|
|
run: west build -t clean
|
2021-05-23 12:21:48 +02:00
|
|
|
- name: Stop container
|
|
|
|
shell: bash
|
|
|
|
run: docker stop candidate
|
|
|
|
- name: Create and run container from 'dev' candidate image
|
|
|
|
shell: bash
|
|
|
|
run: docker run -d -it --name candidate ${{ env.docker-args }} ${{ steps.paths.outputs.dev-candidate }}
|
2021-05-19 12:17:32 +02:00
|
|
|
- name: Test clang-format
|
|
|
|
run: clang-format --version
|
|
|
|
- name: Test node
|
|
|
|
run: node --version
|
|
|
|
- name: Test docs ci
|
|
|
|
run: cd docs && npm ci
|
|
|
|
- name: Test docs lint
|
|
|
|
run: cd docs && npm run lint
|
|
|
|
- name: Test docs prettier check
|
|
|
|
run: cd docs && npm run prettier:check
|
|
|
|
- name: Test docs start (webpack-dev-server)
|
2021-10-26 17:20:41 +02:00
|
|
|
run: cd docs && timeout -s SIGINT 60 npm run start &
|
2021-05-19 12:17:32 +02:00
|
|
|
- run: sleep 15
|
|
|
|
- name: Test docs wget (webpack-dev-server)
|
|
|
|
run: wget http://localhost:3000
|
|
|
|
- run: sleep 10
|
|
|
|
- name: Test docs build (webpack)
|
|
|
|
run: cd docs && npm run build
|
|
|
|
- name: Test docs serve (webpack)
|
|
|
|
run: cd docs && timeout -s SIGINT 10 npm run serve &
|
|
|
|
- run: sleep 5
|
|
|
|
- name: Test docs wget (webpack)
|
|
|
|
run: wget http://localhost:3000
|
2021-05-18 12:28:07 +02:00
|
|
|
- name: Test less
|
|
|
|
run: less --version
|
2021-05-19 19:59:18 +02:00
|
|
|
- name: Test PAGER
|
|
|
|
run: pager --version && [[ $PAGER = "less" ]] && true || false
|
2021-05-19 12:17:32 +02:00
|
|
|
- name: Test ssh
|
|
|
|
run: ssh -V
|
2021-05-18 12:28:16 +02:00
|
|
|
- name: Test gdb
|
|
|
|
run: gdb --version
|
2021-06-15 18:38:34 +02:00
|
|
|
- name: Test arm-zephyr-eabi-gdb
|
|
|
|
if: ${{ matrix.architecture == 'arm' }}
|
|
|
|
run: /opt/zephyr-sdk-${ZEPHYR_SDK_VERSION}/arm-zephyr-eabi/bin/arm-zephyr-eabi-gdb --version
|
2021-06-15 18:27:14 +02:00
|
|
|
- name: Test tio
|
|
|
|
run: tio --version
|
2021-05-20 23:05:24 +02:00
|
|
|
- name: Test socat
|
|
|
|
run: socat -V
|
2021-05-19 12:17:32 +02:00
|
|
|
- name: Stop container
|
|
|
|
shell: bash
|
|
|
|
run: docker stop candidate
|
2022-01-27 20:51:19 +01:00
|
|
|
- name: Build and push 'build' candidate image (x86_64 and arm64)
|
2022-04-16 06:33:45 +02:00
|
|
|
if: ${{ steps.docker-hub-login.outcome == 'success' }}
|
2022-10-28 19:19:40 +02:00
|
|
|
uses: docker/build-push-action@v3
|
2022-01-27 20:51:19 +01:00
|
|
|
with:
|
|
|
|
target: build
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
build-args: |
|
|
|
|
${{ steps.build-args.outputs.list }}
|
|
|
|
labels: |
|
|
|
|
${{ steps.labels.outputs.list }}
|
|
|
|
tags: |
|
|
|
|
${{ steps.paths.outputs.build-candidate }}
|
|
|
|
${{ steps.paths.outputs.build-branch }}
|
|
|
|
cache-from: |
|
|
|
|
type=local,src=${{ steps.paths.outputs.dev-generic }}
|
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-candidate) }}
|
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-branch) }}
|
|
|
|
${{ (env.no-cache == 'false') && (steps.paths.outputs.build-base != '') && format('type=registry,ref={0}', steps.paths.outputs.build-base) || '' }}
|
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-major-minor-branch) }}
|
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-branch-upstream) }}
|
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-major-minor-branch-upstream) }}
|
|
|
|
cache-to: type=inline
|
|
|
|
push: true
|
|
|
|
- name: Build and push 'dev' candidate image (x86_64 + arm64)
|
2022-04-16 06:33:45 +02:00
|
|
|
if: ${{ steps.docker-hub-login.outcome == 'success' }}
|
2022-10-28 19:19:40 +02:00
|
|
|
uses: docker/build-push-action@v3
|
2022-01-27 20:51:19 +01:00
|
|
|
with:
|
|
|
|
target: dev
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
build-args: |
|
|
|
|
${{ steps.build-args.outputs.list }}
|
|
|
|
labels: |
|
|
|
|
${{ steps.labels.outputs.list }}
|
|
|
|
tags: |
|
|
|
|
${{ steps.paths.outputs.dev-candidate }}
|
|
|
|
${{ steps.paths.outputs.dev-branch }}
|
|
|
|
cache-from: |
|
|
|
|
type=registry,ref=${{ steps.paths.outputs.build-candidate }}
|
|
|
|
type=local,src=${{ steps.paths.outputs.dev-generic }}
|
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-candidate) }}
|
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-branch) }}
|
|
|
|
${{ (env.no-cache == 'false') && (steps.paths.outputs.dev-base != '') && format('type=registry,ref={0}', steps.paths.outputs.dev-base) || '' }}
|
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-major-minor-branch) }}
|
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-branch-upstream) }}
|
|
|
|
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-major-minor-branch-upstream) }}
|
|
|
|
cache-to: type=inline
|
|
|
|
push: true
|
2021-05-25 20:29:17 +02:00
|
|
|
release-trigger:
|
|
|
|
if: ${{ startsWith(github.ref, 'refs/tags') }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
tag: ${{ steps.match.outputs.tag }}
|
|
|
|
branch: ${{ steps.match.outputs.branch }}
|
|
|
|
datetime: ${{ steps.match.outputs.datetime }}
|
|
|
|
date: ${{ steps.match.outputs.date }}
|
|
|
|
year: ${{ steps.match.outputs.year }}
|
|
|
|
month: ${{ steps.match.outputs.month }}
|
|
|
|
day: ${{ steps.match.outputs.day }}
|
|
|
|
time: ${{ steps.match.outputs.time }}
|
|
|
|
hour: ${{ steps.match.outputs.hour }}
|
|
|
|
minute: ${{ steps.match.outputs.minute }}
|
|
|
|
second: ${{ steps.match.outputs.second }}
|
|
|
|
zephyr-version: ${{ steps.match.outputs.zephyr-version }}
|
|
|
|
zephyr-version-major: ${{ steps.match.outputs.zephyr-version-major }}
|
|
|
|
zephyr-version-minor: ${{ steps.match.outputs.zephyr-version-minor }}
|
|
|
|
zephyr-version-patch: ${{ steps.match.outputs.zephyr-version-patch }}
|
|
|
|
zephyr-sdk-version: ${{ steps.match.outputs.zephyr-sdk-version }}
|
|
|
|
zephyr-sdk-version-major: ${{ steps.match.outputs.zephyr-sdk-version-major }}
|
|
|
|
zephyr-sdk-version-minor: ${{ steps.match.outputs.zephyr-sdk-version-minor }}
|
|
|
|
zephyr-sdk-version-patch: ${{ steps.match.outputs.zephyr-sdk-version-patch }}
|
|
|
|
sha: ${{ steps.match.outputs.sha }}
|
|
|
|
run-id: ${{ steps.match.outputs.run-id }}
|
|
|
|
steps:
|
|
|
|
- name: Is tag a release trigger?
|
|
|
|
id: match
|
|
|
|
run: |
|
|
|
|
TAG=${GITHUB_REF#refs/tags/}
|
|
|
|
PATTERN="^(.+?)-((([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01]))(([01]?[0-9]|2[0-3])([0-5][0-9])([0-5][0-9])))-(([0-9]+)\.([0-9]+)\.([0-9]+))-(([0-9]+)\.([0-9]+)\.([0-9]+))-([0-9a-fA-F]+)-([0-9]+)$"
|
|
|
|
if [[ "${TAG}" =~ $PATTERN ]]; then
|
2022-10-29 18:01:10 +02:00
|
|
|
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
|
|
|
echo "branch=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
|
|
|
|
echo "datetime=${BASH_REMATCH[2]}" >> $GITHUB_OUTPUT
|
|
|
|
echo "date=${BASH_REMATCH[3]}" >> $GITHUB_OUTPUT
|
|
|
|
echo "year=${BASH_REMATCH[4]}" >> $GITHUB_OUTPUT
|
|
|
|
echo "month=${BASH_REMATCH[5]}" >> $GITHUB_OUTPUT
|
|
|
|
echo "day=${BASH_REMATCH[6]}" >> $GITHUB_OUTPUT
|
|
|
|
echo "time=${BASH_REMATCH[7]}" >> $GITHUB_OUTPUT
|
|
|
|
echo "hour=${BASH_REMATCH[8]}" >> $GITHUB_OUTPUT
|
|
|
|
echo "minute=${BASH_REMATCH[9]}" >> $GITHUB_OUTPUT
|
|
|
|
echo "second=${BASH_REMATCH[10]}" >> $GITHUB_OUTPUT
|
|
|
|
echo "zephyr-version=${BASH_REMATCH[11]}" >> $GITHUB_OUTPUT
|
|
|
|
echo "zephyr-version-major=${BASH_REMATCH[12]}" >> $GITHUB_OUTPUT
|
|
|
|
echo "zephyr-version-minor=${BASH_REMATCH[13]}" >> $GITHUB_OUTPUT
|
|
|
|
echo "zephyr-version-patch=${BASH_REMATCH[14]}" >> $GITHUB_OUTPUT
|
|
|
|
echo "zephyr-sdk-version=${BASH_REMATCH[15]}" >> $GITHUB_OUTPUT
|
|
|
|
echo "zephyr-sdk-version-major=${BASH_REMATCH[16]}" >> $GITHUB_OUTPUT
|
|
|
|
echo "zephyr-sdk-version-minor=${BASH_REMATCH[17]}" >> $GITHUB_OUTPUT
|
|
|
|
echo "zephyr-sdk-version-patch=${BASH_REMATCH[18]}" >> $GITHUB_OUTPUT
|
2021-05-25 20:29:17 +02:00
|
|
|
SHA=${BASH_REMATCH[19]}
|
2022-10-29 18:01:10 +02:00
|
|
|
echo "sha=${SHA}" >> $GITHUB_OUTPUT
|
|
|
|
echo "run-id=${BASH_REMATCH[20]}" >> $GITHUB_OUTPUT
|
2021-05-25 20:29:17 +02:00
|
|
|
|
|
|
|
if [[ "${{ github.sha }}" != ${SHA}* ]]; then
|
|
|
|
echo "Hashes do not match!"
|
|
|
|
echo "${{ github.sha }}"
|
|
|
|
echo "${SHA}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Tag not recognised, ignoring ..."
|
|
|
|
fi
|
2021-05-14 20:12:34 +02:00
|
|
|
releases:
|
|
|
|
needs:
|
|
|
|
- architectures
|
|
|
|
- tags
|
2021-05-25 20:29:17 +02:00
|
|
|
- release-trigger
|
|
|
|
if: ${{ needs.release-trigger.outputs.sha != null }}
|
2021-05-14 20:12:34 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
architecture: ${{ fromJSON(needs.architectures.outputs.json) }}
|
|
|
|
target:
|
|
|
|
- build
|
|
|
|
- dev
|
|
|
|
steps:
|
2022-10-26 06:09:30 +02:00
|
|
|
- name: Install skopeo
|
|
|
|
run: sudo apt-get install -y skopeo
|
2021-05-14 20:12:34 +02:00
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
id: ghcr-login
|
2023-07-21 10:52:30 +02:00
|
|
|
if: ${{ env.ghcr-credentials == 'true' }}
|
2022-10-28 19:19:40 +02:00
|
|
|
uses: docker/login-action@v2
|
2021-05-14 20:12:34 +02:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ secrets.GHCR_USERNAME }}
|
|
|
|
password: ${{ secrets.GHCR_TOKEN }}
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
id: docker-hub-login
|
2023-07-21 10:52:30 +02:00
|
|
|
if: ${{ env.docker-hub-credentials == 'true' }}
|
2022-10-28 19:19:40 +02:00
|
|
|
uses: docker/login-action@v2
|
2021-05-14 20:12:34 +02:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
2023-07-21 10:44:19 +02:00
|
|
|
- name: Login to Gitea
|
|
|
|
id: docker-hub-login
|
2023-07-21 10:52:30 +02:00
|
|
|
if: ${{ env.gitea-credentials == 'true' }}
|
2023-07-21 10:44:19 +02:00
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
registry: git.sporq.de
|
|
|
|
username: ${{ secrets.GITEA_USERNAME }}
|
|
|
|
password: ${{ secrets.GITEA_TOKEN }}
|
2021-05-09 16:59:20 +02:00
|
|
|
- name: Release (pull candidate, tag, push)
|
2021-05-14 20:12:34 +02:00
|
|
|
env:
|
|
|
|
DHNS: ${{ env.docker-hub-namespace }}
|
|
|
|
GHCRNS: ${{ env.ghcr-namespace }}
|
|
|
|
TARGET: ${{ matrix.target }}
|
|
|
|
ARCHITECTURE: ${{ matrix.architecture }}
|
2021-05-25 20:29:17 +02:00
|
|
|
CANDIDATE: ${{ needs.release-trigger.outputs.tag }}
|
2021-05-14 20:12:34 +02:00
|
|
|
VERSIONS: ${{ needs.tags.outputs.versions }}
|
2021-06-10 20:43:38 +02:00
|
|
|
MAJOR_MINOR: ${{ needs.tags.outputs.major-minor }}
|
2020-12-03 11:34:06 +01:00
|
|
|
run: |
|
2021-05-14 20:12:34 +02:00
|
|
|
REPOSITORY=zmk-${TARGET}-${ARCHITECTURE}
|
|
|
|
|
2022-10-26 06:09:30 +02:00
|
|
|
skopeo copy --all docker://docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker://docker.io/${DHNS}/${REPOSITORY}:${VERSIONS}
|
|
|
|
skopeo copy --all docker://docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker://docker.io/${DHNS}/${REPOSITORY}:${MAJOR_MINOR}
|
|
|
|
skopeo copy --all docker://docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker://ghcr.io/${GHCRNS}/${REPOSITORY}:${CANDIDATE}
|
|
|
|
skopeo copy --all docker://docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker://ghcr.io/${GHCRNS}/${REPOSITORY}:${VERSIONS}
|
|
|
|
skopeo copy --all docker://docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker://ghcr.io/${GHCRNS}/${REPOSITORY}:${MAJOR_MINOR}
|
2021-05-14 20:12:34 +02:00
|
|
|
git-tag:
|
2021-05-14 20:12:34 +02:00
|
|
|
needs:
|
2021-05-14 20:12:34 +02:00
|
|
|
- tags
|
2021-05-14 20:12:34 +02:00
|
|
|
- releases
|
2021-05-14 20:12:34 +02:00
|
|
|
runs-on: ubuntu-latest
|
2020-12-03 11:34:06 +01:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-11-03 16:36:37 +01:00
|
|
|
uses: actions/checkout@v3
|
2020-12-03 11:34:06 +01:00
|
|
|
- name: Tag
|
|
|
|
env:
|
2021-05-14 20:12:34 +02:00
|
|
|
TAG: ${{ needs.tags.outputs.major-minor }}
|
2020-12-03 11:34:06 +01:00
|
|
|
run: |
|
|
|
|
git tag ${TAG}
|
|
|
|
git push -f origin ${TAG}
|
2022-03-05 05:41:44 +01:00
|
|
|
stable-release-trigger:
|
|
|
|
if: ${{ startsWith(github.ref, 'refs/tags') }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
tag: ${{ steps.match.outputs.tag }}
|
|
|
|
stable-tag: ${{ steps.match.outputs.stable-tag }}
|
|
|
|
steps:
|
|
|
|
- name: Is tag a release trigger?
|
|
|
|
id: match
|
|
|
|
run: |
|
|
|
|
TAG=${GITHUB_REF#refs/tags/}
|
|
|
|
PATTERN="^(.+?)-stable$"
|
|
|
|
if [[ "${TAG}" =~ $PATTERN ]]; then
|
2022-10-29 18:01:10 +02:00
|
|
|
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
|
|
|
echo "stable-tag=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
|
2022-03-05 05:41:44 +01:00
|
|
|
else
|
|
|
|
echo "Tag not recognised, ignoring ..."
|
|
|
|
fi
|
|
|
|
stable-releases:
|
|
|
|
needs:
|
|
|
|
- architectures
|
|
|
|
- tags
|
|
|
|
- stable-release-trigger
|
|
|
|
if: ${{ needs.stable-release-trigger.outputs.stable-tag != null }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
architecture: ${{ fromJSON(needs.architectures.outputs.json) }}
|
|
|
|
target:
|
|
|
|
- build
|
|
|
|
- dev
|
|
|
|
steps:
|
2022-10-26 06:09:30 +02:00
|
|
|
- name: Install skopeo
|
|
|
|
run: sudo apt-get install -y skopeo
|
2022-03-05 05:41:44 +01:00
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
id: ghcr-login
|
2023-07-21 10:52:30 +02:00
|
|
|
if: ${{ env.ghcr-credentials == 'true' }}
|
2022-10-28 19:19:40 +02:00
|
|
|
uses: docker/login-action@v2
|
2022-03-05 05:41:44 +01:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ secrets.GHCR_USERNAME }}
|
|
|
|
password: ${{ secrets.GHCR_TOKEN }}
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
id: docker-hub-login
|
2023-07-21 10:52:30 +02:00
|
|
|
if: ${{ env.docker-hub-credentials == 'true' }}
|
2022-10-28 19:19:40 +02:00
|
|
|
uses: docker/login-action@v2
|
2022-03-05 05:41:44 +01:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
2023-07-21 10:44:19 +02:00
|
|
|
- name: Login to Gitea
|
|
|
|
id: docker-hub-login
|
2023-07-21 10:52:30 +02:00
|
|
|
if: ${{ env.gitea-credentials == 'true' }}
|
2023-07-21 10:44:19 +02:00
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
registry: git.sporq.de
|
|
|
|
username: ${{ secrets.GITEA_USERNAME }}
|
|
|
|
password: ${{ secrets.GITEA_TOKEN }}
|
2022-03-05 05:41:44 +01:00
|
|
|
- name: Release (pull candidate, tag, push)
|
|
|
|
env:
|
|
|
|
DHNS: ${{ env.docker-hub-namespace }}
|
|
|
|
GHCRNS: ${{ env.ghcr-namespace }}
|
|
|
|
TARGET: ${{ matrix.target }}
|
|
|
|
ARCHITECTURE: ${{ matrix.architecture }}
|
|
|
|
CANDIDATE: ${{ needs.stable-release-trigger.outputs.stable-tag }}
|
|
|
|
run: |
|
|
|
|
REPOSITORY=zmk-${TARGET}-${ARCHITECTURE}
|
|
|
|
|
2022-10-26 06:09:30 +02:00
|
|
|
skopeo copy --all docker://docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker://docker.io/${DHNS}/${REPOSITORY}:stable
|
2022-03-05 05:41:44 +01:00
|
|
|
stable-git-tag:
|
|
|
|
needs:
|
|
|
|
- tags
|
|
|
|
- stable-releases
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-11-03 16:36:37 +01:00
|
|
|
uses: actions/checkout@v3
|
2022-03-05 05:41:44 +01:00
|
|
|
with:
|
|
|
|
ref: ${{ needs.stable-release-trigger.outputs.stable-tag }}
|
|
|
|
- name: Tag
|
|
|
|
env:
|
|
|
|
TAG: ${{ needs.tags.outputs.major-minor }}
|
|
|
|
run: |
|
|
|
|
git tag stable
|
|
|
|
git push -f origin stable
|