1
+ name : release
2
+
3
+ on :
4
+ push :
5
+ tags :
6
+ - " [0-9]+.[0-9]+.[0-9]+*"
7
+
8
+ jobs :
9
+ core-pre-release-from-tag :
10
+ runs-on : ubuntu-latest
11
+
12
+ steps :
13
+ - name : Checkout repository
14
+ uses : actions/checkout@v2
15
+
16
+ - name : Checkout ArduinoCore-API
17
+ uses : actions/checkout@v2
18
+ with :
19
+ repository : arduino/ArduinoCore-API
20
+ path : extras/ArduinoCore-API
21
+
22
+ - name : Check if API should be compiled in the core
23
+ id : checkapi
24
+ run : |
25
+ if [[ $(grep -r api platform.txt) ]]; then echo "::set-output name=IS_API::true"; fi
26
+
27
+ - name : Checkout latest tag of ArduinoCore-API and add it to the core
28
+ run : |
29
+ cd extras/ArduinoCore-API
30
+ git fetch --tags
31
+ git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
32
+ cd ../..
33
+ mv "$GITHUB_WORKSPACE/extras/ArduinoCore-API/api" "$GITHUB_WORKSPACE/cores/arduino"
34
+ if : steps.checkapi.outputs.IS_API == 'true'
35
+
36
+ - name : Remove ArduinoCore-API
37
+ run : rm -r "$GITHUB_WORKSPACE/extras/ArduinoCore-API"
38
+
39
+ - name : Set env
40
+ run : echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
41
+
42
+ - name : Get repo name
43
+ run : echo "REPOSITORY_NAME=$(echo ${{ github.repository }} | cut -d "/" -f2-)" >> $GITHUB_ENV
44
+
45
+ - name : Package the new core
46
+ run : |
47
+ extras/pack.release.bash $TAG_VERSION $REPOSITORY_NAME
48
+ cd extras
49
+ mkdir staging
50
+ echo $PWD
51
+ mv ../*.json staging/
52
+ mv ../*.tar.bz2 staging/
53
+ cd ..
54
+
55
+ - name : Get architecture name
56
+ run : |
57
+ echo "ARCHITECTURE=$(cat extras/package_index.json.NewTag.template | jq ".packages[0].platforms[0].architecture" | sed 's/\"//g')" >> $GITHUB_ENV
58
+
59
+ - name : Upload package_*_index.json and *.tar.bz2 file to Arduino downloads servers
60
+ env :
61
+ AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
62
+ AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
63
+ run : |
64
+ aws s3 sync extras/staging/ s3://${{ secrets.ARDUINO_DOWNLOADS_BUCKET }}/packages/staging/ --exclude "*" --include *.json
65
+ aws s3 sync extras/staging/ s3://${{ secrets.ARDUINO_DOWNLOADS_BUCKET }}/cores/staging/ --exclude "*" --include *.tar.bz2
66
+
67
+ - name : Checkout Basic examples
68
+ uses : actions/checkout@v2
69
+ with :
70
+ repository : arduino/arduino-examples
71
+ path : extras/arduino-examples
72
+
73
+ - name : Install Arduino CLI
74
+ uses : arduino/setup-arduino-cli@v1.1.1
75
+ with :
76
+ version : " 0.14.0"
77
+
78
+ - name : Download and verify new core
79
+ run : |
80
+ export PATH=$PATH:$PWD
81
+ arduino-cli version
82
+ cp extras/staging/package_${REPOSITORY_NAME}_${TAG_VERSION}_index.json .
83
+ export ARDUINO_DIRECTORIES_DATA=$PWD
84
+ export ARDUINO_BOARD_MANAGER_ADDITIONAL_URLS=file://$PWD/package_${REPOSITORY_NAME}_${TAG_VERSION}_index.json
85
+ arduino-cli config init
86
+ arduino-cli config dump -v
87
+ arduino-cli core update-index -v
88
+ arduino-cli core install arduino:${ARCHITECTURE}@${TAG_VERSION}
89
+ INDEX=0
90
+ arduino-cli board listall --format=json > boardlist.json
91
+ N=$(jq '.boards | length' boardlist.json)
92
+ let N=N-1
93
+ echo $N
94
+ for INDEX in $(seq 0 1 $N); do arduino-cli compile --fqbn $(cat boardlist.json | jq ".boards[$INDEX].FQBN" | sed 's/\"//g') $PWD/extras/arduino-examples/examples/01.Basics/Blink; done
95
+
96
+ # See: https://github.com/rtCamp/action-slack-notify
97
+ - name : Slack notification of core pre-release
98
+ uses : rtCamp/action-slack-notify@v2.1.0
99
+ env :
100
+ SLACK_CHANNEL : core_releases
101
+ SLACK_COLOR : good
102
+ SLACK_USERNAME : ArduinoBot
103
+ SLACK_ICON : https://github.com/arduino.png?size=48
104
+ SLACK_TITLE : Arduino core pre-release
105
+ SLACK_MESSAGE : ' Version ${{ env.TAG_VERSION }} of core ${{ env.REPOSITORY_NAME }} is now available'
106
+ SLACK_WEBHOOK : ${{ secrets.SLACK_WEBHOOK }}
107
+ MSG_MINIMAL : true
0 commit comments