-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (54 loc) · 1.71 KB
/
deploy.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
name: Deploy Workflow
on:
push:
branches:
- main
jobs:
prepare-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
has-changes: ${{ steps.set-matrix.outputs.has-changes }}
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
fetch-depth: 0 # Fetch all history for all branches and tags
- id: set-matrix
run: |
changed_dirs=$(git diff --name-only HEAD^ HEAD | grep '^actions/' | cut -d'/' -f1-2 | uniq)
if [ -z "$changed_dirs" ]; then
echo "::set-output name=has-changes::false"
else
matrix=$(echo "$changed_dirs" | jq -R -s -c 'split("\n")[:-1]')
echo "::set-output name=matrix::$matrix"
echo "::set-output name=has-changes::true"
fi
build-and-deploy:
needs: prepare-matrix
runs-on: ubuntu-latest
if: needs.prepare-matrix.outputs.has-changes == 'true'
strategy:
fail-fast: false
matrix:
action: ${{fromJson(needs.prepare-matrix.outputs.matrix)}}
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Set up Roboto Config
run: |
mkdir -p ~/.roboto
echo '${{ secrets.ROBOTO_CONFIG }}' > ~/.roboto/config.json
- name: Run setup script
run: ${{ matrix.action }}/scripts/setup.sh
- name: Run build script
run: ${{ matrix.action }}/scripts/build.sh
- name: Run test script
run: sudo ${{ matrix.action }}/scripts/test.sh
- name: Run deploy script
run: ${{ matrix.action }}/scripts/deploy.sh roboto-public