Skip to content

Commit bcffb3b

Browse files
committed
Add github release scripts
1 parent 24a1968 commit bcffb3b

File tree

3 files changed

+223
-0
lines changed

3 files changed

+223
-0
lines changed

Diff for: .github/release.yaml

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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

Diff for: extras/pack.release.bash

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash -ex
2+
3+
# pack.*.bash - Bash script to help packaging samd core releases.
4+
# Copyright (c) 2015 Arduino LLC. All right reserved.
5+
#
6+
# This library is free software; you can redistribute it and/or
7+
# modify it under the terms of the GNU Lesser General Public
8+
# License as published by the Free Software Foundation; either
9+
# version 2.1 of the License, or (at your option) any later version.
10+
#
11+
# This library is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
# Lesser General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU Lesser General Public
17+
# License along with this library; if not, write to the Free Software
18+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19+
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
25+
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
31+
32+
PWD=`pwd`
33+
FOLDERNAME=`basename $PWD`
34+
THIS_SCRIPT_NAME=`basename $0`
35+
FILENAME=core-$CORE_NAME-$VERSION.tar.bz2
36+
echo $FILENAME
37+
38+
rm -f *.tar.bz2
39+
rm -f *.json
40+
41+
cd ..
42+
tar --exclude=extras/** --exclude=.git* --exclude=.idea -cjhf $FILENAME $FOLDERNAME
43+
cd -
44+
45+
mv ../$FILENAME .
46+
47+
CHKSUM=`sha256sum $FILENAME | awk '{ print $1 }'`
48+
SIZE=`wc -c $FILENAME | awk '{ print $1 }'`
49+
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

Diff for: extras/package_index.json.NewTag.template

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"packages": [
3+
{
4+
"name": "arduino",
5+
"maintainer": "Arduino Betatesting",
6+
"websiteURL": "http://www.arduino.cc/",
7+
"email": "packages@arduino.cc",
8+
"help": {
9+
"online": "http://www.arduino.cc/en/Reference/HomePage"
10+
},
11+
"platforms": [
12+
{
13+
"name": "Arduino mbed-enabled Boards - Pre-release",
14+
"architecture": "mbed",
15+
"version": "%%VERSION%%",
16+
"category": "Contributed",
17+
"url": "http://downloads.arduino.cc/cores/staging/%%FILENAME%%",
18+
"archiveFileName": "%%FILENAME%%",
19+
"checksum": "SHA-256:%%CHECKSUM%%",
20+
"size": "%%SIZE%%",
21+
"help": {
22+
"online": "https://github.com/arduino/ArduinoCore-mbed/issues"
23+
},
24+
"boards": [
25+
{
26+
"name": "Arduino Portenta H7"
27+
},
28+
{
29+
"name": "Arduino Nano 33 BLE"
30+
}
31+
],
32+
"toolsDependencies": [
33+
{
34+
"packager": "arduino",
35+
"name": "openocd",
36+
"version": "0.10.0-arduino13"
37+
},
38+
{
39+
"packager": "arduino",
40+
"name": "arm-none-eabi-gcc",
41+
"version": "7-2017q4"
42+
},
43+
{
44+
"packager": "arduino",
45+
"name": "bossac",
46+
"version": "1.9.1-arduino2"
47+
},
48+
{
49+
"packager": "arduino",
50+
"version": "0.9.0-arduino2",
51+
"name": "dfu-util"
52+
}
53+
]
54+
}
55+
],
56+
"tools": [
57+
]
58+
}
59+
]
60+
}

0 commit comments

Comments
 (0)