Skip to content

Commit 96fba00

Browse files
authored
Merge pull request #573 from giulcioffi/action_core_release
Action for core release
2 parents 203c290 + 8cdcc3f commit 96fba00

File tree

3 files changed

+207
-3
lines changed

3 files changed

+207
-3
lines changed

.github/workflows/release.yaml

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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/[email protected]
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/[email protected]
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

extras/pack.release.bash

+26-3
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,40 @@
1717
# License along with this library; if not, write to the Free Software
1818
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1919

20+
# Version check removed because version string passed from jenkins was incorrect
21+
VERSION_FROM_TAG=$1
22+
CORE_NAME=$2
23+
echo $VERSION_FROM_TAG
24+
echo $CORE_NAME
2025
VERSION=`grep version= platform.txt | sed 's/version=//g'`
26+
echo $VERSION
27+
28+
if [ $VERSION != $VERSION_FROM_TAG ]; then
29+
exit 0
30+
fi
2131

2232
PWD=`pwd`
2333
FOLDERNAME=`basename $PWD`
2434
THIS_SCRIPT_NAME=`basename $0`
35+
FILENAME=core-$CORE_NAME-$VERSION.tar.bz2
36+
echo $FILENAME
2537

26-
rm -f samd-$VERSION.tar.bz2
38+
rm -f *.tar.bz2
39+
rm -f *.json
2740

2841
cd ..
29-
tar --transform "s|$FOLDERNAME|$FOLDERNAME-$VERSION|g" --exclude=extras/** --exclude=.git* --exclude=.idea -cjf samd-$VERSION.tar.bz2 $FOLDERNAME
42+
tar --exclude=extras/** --exclude=.git* --exclude=.idea -cjhf $FILENAME $FOLDERNAME
3043
cd -
3144

32-
mv ../samd-$VERSION.tar.bz2 .
45+
mv ../$FILENAME .
46+
47+
CHKSUM=`sha256sum $FILENAME | awk '{ print $1 }'`
48+
SIZE=`wc -c $FILENAME | awk '{ print $1 }'`
3349

50+
cat extras/package_index.json.NewTag.template |
51+
# sed "s/%%BUILD_NUMBER%%/${BUILD_NUMBER}/" |
52+
# sed "s/%%CURR_TIME%%/${CURR_TIME_SED}/" |
53+
sed "s/%%VERSION%%/${VERSION}/" |
54+
sed "s/%%FILENAME%%/${FILENAME}/" |
55+
sed "s/%%CHECKSUM%%/${CHKSUM}/" |
56+
sed "s/%%SIZE%%/${SIZE}/" > package_${CORE_NAME}_${VERSION}_index.json
+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"packages": [
3+
{
4+
"name": "arduino",
5+
"maintainer": "Arduino Betatesting",
6+
"websiteURL": "http://www.arduino.cc/",
7+
"email": "[email protected]",
8+
"help": {
9+
"online": "http://www.arduino.cc/en/Reference/HomePage"
10+
},
11+
"platforms": [
12+
{
13+
"name": "Arduino SAMD Boards (32-bits ARM Cortex-M0+) - Pre-release",
14+
"architecture": "samd",
15+
"version": "%%VERSION%%",
16+
"category": "Arduino",
17+
"help": {
18+
"online": "http://www.arduino.cc/en/Reference/HomePage"
19+
},
20+
"url": "http://downloads.arduino.cc/cores/staging/%%FILENAME%%",
21+
"archiveFileName": "%%FILENAME%%",
22+
"checksum": "SHA-256:%%CHECKSUM%%",
23+
"size": "%%SIZE%%",
24+
"boards": [
25+
{ "name": "Arduino MKR WiFi 1010" },
26+
{ "name": "Arduino Zero" },
27+
{ "name": "Arduino MKR1000" },
28+
{ "name": "Arduino MKRZERO" },
29+
{ "name": "Arduino MKR FOX 1200" },
30+
{ "name": "Arduino MKR WAN 1300" },
31+
{ "name": "Arduino MKR WAN 1310" },
32+
{ "name": "Arduino MKR GSM 1400" },
33+
{ "name": "Arduino MKR NB 1500" },
34+
{ "name": "Arduino MKR Vidor 4000" },
35+
{ "name": "Arduino Nano 33 IoT" },
36+
{ "name": "Arduino M0 Pro" },
37+
{ "name": "Arduino M0" },
38+
{ "name": "Arduino Tian" },
39+
{ "name": "Adafruit Circuit Playground Express" }
40+
],
41+
"toolsDependencies": [
42+
{
43+
"packager": "arduino",
44+
"name": "arm-none-eabi-gcc",
45+
"version": "7-2017q4"
46+
},
47+
{
48+
"packager": "arduino",
49+
"name": "bossac",
50+
"version": "1.7.0-arduino3"
51+
},
52+
{
53+
"packager": "arduino",
54+
"name": "openocd",
55+
"version": "0.10.0-arduino7"
56+
},
57+
{
58+
"packager": "arduino",
59+
"name": "CMSIS",
60+
"version": "4.5.0"
61+
},
62+
{
63+
"packager": "arduino",
64+
"name": "CMSIS-Atmel",
65+
"version": "1.2.0"
66+
},
67+
{
68+
"packager": "arduino",
69+
"name": "arduinoOTA",
70+
"version": "1.2.1"
71+
}
72+
]
73+
}
74+
],
75+
"tools": [
76+
]
77+
}
78+
]
79+
}

0 commit comments

Comments
 (0)