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