summaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
blob: 23c3edf2acb38396e26d8ed4ccefcf72dadb532a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
on: [push, pull_request, workflow_dispatch]

name: Build

jobs:
  build:
    runs-on: ubuntu-latest
    container:
      image: zmkfirmware/zmk-build-arm:stable
    name: Build
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Get version data
        id: get_info
        run: |
          timestamp=$(date +"%Y%m%d%H%M")
          commit=$(echo "${{ github.sha }}" | cut -c1-7)
          file_prefix=$timestamp-$commit
          branch_name=$(echo "${{ github.ref }}" | awk -F'/' '{print $3}' | cut -c1-4)
          echo "file_prefix=$file_prefix" >> $GITHUB_OUTPUT
          bin/get_version.sh $branch_name $commit
      - name: Cache west modules
        uses: actions/cache@v3
        env:
          cache-name: cache-zephyr-modules
        with:
          path: |
            modules/
            tools/
            zephyr/
            bootloader/
            zmk/
          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('manifest-dir/west.yml') }}
          restore-keys: |
            ${{ runner.os }}-build-${{ env.cache-name }}-
            ${{ runner.os }}-build-
            ${{ runner.os }}-
      - name: West Init
        run: west init -l config
      - name: West Update
        run: west update
      - name: West Zephyr export
        run: west zephyr-export
      - name: West Build (left)
        run: west build -s zmk/app -d build/left -b adv360_left -- -DZMK_CONFIG="${GITHUB_WORKSPACE}/config"
      - name: Adv360 Left Kconfig file
        run: grep -vE '(^#|^$)' build/left/zephyr/.config
      - name: West Build (right)
        run: west build -s zmk/app -d build/right -b adv360_right -- -DZMK_CONFIG="${GITHUB_WORKSPACE}/config"
      - name: Adv360 Right Kconfig file
        run: grep -vE '(^#|^$)' build/right/zephyr/.config
      - name: Rename zmk.uf2
        run: cp build/left/zephyr/zmk.uf2 ${{ steps.get_info.outputs.file_prefix }}-left.uf2 && cp build/right/zephyr/zmk.uf2 ${{ steps.get_info.outputs.file_prefix }}-right.uf2
      - name: Archive (Adv360)
        uses: actions/upload-artifact@v3
        with:
          name: firmware
          path: |
            ${{ steps.get_info.outputs.file_prefix }}-left.uf2
            ${{ steps.get_info.outputs.file_prefix }}-right.uf2