forked from manna-harbour/miryoku_qmk
-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (127 loc) · 4.7 KB
/
main.yml
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Copyright 2021 Manna Harbour
# https://github.com/manna-harbour/miryoku
name: 'Main'
on:
workflow_call:
inputs:
keyboard:
type: string
default: '["default"]'
alphas:
type: string
default: '["default"]'
nav:
type: string
default: '["default"]'
clipboard:
type: string
default: '["default"]'
layers:
type: string
default: '["default"]'
mapping:
type: string
default: '["default"]'
rules:
type: string
default: '["default"]'
custom_config:
type: string
default: '["default"]'
merge:
type: string
default: '["default"]'
jobs:
main:
runs-on: ubuntu-latest
container: qmkfm/qmk_cli
strategy:
fail-fast: false
matrix:
keyboard: ${{ fromJSON(inputs.keyboard) }}
alphas: ${{ fromJSON(inputs.alphas) }}
nav: ${{ fromJSON(inputs.nav) }}
clipboard: ${{ fromJSON(inputs.clipboard) }}
layers: ${{ fromJSON(inputs.layers) }}
mapping: ${{ fromJSON(inputs.mapping) }}
rules: ${{ fromJSON(inputs.rules) }}
custom_config: ${{ fromJSON(inputs.custom_config) }}
merge: ${{ fromJSON(inputs.merge) }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Merge branches
if: ${{ matrix.merge != '' && matrix.merge != 'default' }}
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git fetch --unshallow
revert=`git log --committer='Manna Harbour <[email protected]>' --grep='^\[local\]' --pretty='format:%H' | tr '\n' ' '`
git revert $revert
for merge in ${{ matrix.merge }}
do
user=`echo "$merge" | cut -f 1 -d '/'`
repo=`echo "$merge" | cut -f 2 -d '/'`
branch=`echo "$merge" | cut -f 3- -d '/'`
remote="$user-$repo"
git remote add "$remote" "https://github.com/$user/$repo.git"
git fetch "$remote" "$branch"
git merge "$remote/$branch"
git remote remove "$remote"
git status
done
- name: Submodules
run: make git-submodule
- name: Process inputs
id: inputs
run: |
artifacts_dir="artifacts"
mkdir "$artifacts_dir"
user='users/manna-harbour_miryoku'
rules="$user/custom_rules.mk"
config="$user/custom_config.h"
artifact_build_name=`echo "miryoku_qmk ${{ matrix.keyboard }}" | tr '/' '_'`
for option in "alphas=${{ matrix.alphas }}" "nav=${{ matrix.nav }}" "clipboard=${{ matrix.clipboard }}" "layers=${{ matrix.layers }}" "mapping=${{ matrix.mapping }}"
do
if ! expr "$option" : '.*=default$'
then
artifact_build_name="$artifact_build_name "`echo "$option" | tr '=' '_'`
option=`echo "MIRYOKU_$option" | tr 'a-z' 'A-Z'`
echo "$option" >> "$rules"
fi
done
if [ -n "${{ matrix.rules }}" -a "${{ matrix.rules }}" != 'default' ]
then
artifact_build_name="$artifact_build_name rules_"`echo "${{ matrix.rules }}" | md5sum | cut -d ' ' -f 1`
echo "${{ matrix.rules }}" >> "$rules"
fi
if [ -n "${{ matrix.custom_config }}" -a "${{ matrix.custom_config }}" != 'default' ]
then
artifact_build_name="$artifact_build_name config_"`echo "${{ matrix.custom_config }}" | md5sum | cut -d ' ' -f 1`
echo "${{ matrix.custom_config }}" >> "$config"
fi
cp "$rules" "$config" "$artifacts_dir"
if [ -n "${{ matrix.merge }}" -a "${{ matrix.merge }}" != 'default' ]
then
artifact_build_name="$artifact_build_name merge_"`echo "${{ matrix.merge }}" | md5sum | cut -d ' ' -f 1`
fi
artifact_build_name=`echo $artifact_build_name | tr ' ' '-'`
echo "::set-output name=artifact-dir::$artifacts_dir"
echo "::set-output name=artifact-build-name::$artifact_build_name"
- name: Build
run: qmk compile -kb ${{ matrix.keyboard }} -km manna-harbour_miryoku
- name: Copy firmware
run: |
for file in *.hex *.bin
do
if [ -f "$file" ]
then
cp "$file" "${{ steps.inputs.outputs.artifact-dir }}"
fi
done
- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ steps.inputs.outputs.artifact-build-name }}
path: ${{ steps.inputs.outputs.artifact-dir }}
continue-on-error: true