Skip to content

Commit 2237a74

Browse files
committed
Add github action for core release
1 parent 268fefd commit 2237a74

File tree

3 files changed

+188
-4
lines changed

3 files changed

+188
-4
lines changed

Diff for: .github/workflows/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

+27-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -ex
22

3-
# pack.*.bash - Bash script to help packaging avr core releases.
3+
# pack.*.bash - Bash script to help packaging samd core releases.
44
# Copyright (c) 2015 Arduino LLC. All right reserved.
55
#
66
# This library is free software; you can redistribute it and/or
@@ -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 avr-$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 avr-$VERSION.tar.bz2 $FOLDERNAME
42+
tar --exclude=extras/** --exclude=.git* --exclude=.idea -cjhf $FILENAME $FOLDERNAME
3043
cd -
3144

32-
mv ../avr-$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

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

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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 megaAVR Boards - Pre-release",
14+
"architecture": "megaavr",
15+
"version": "%%VERSION%%",
16+
"category": "Arduino",
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-megaavr/issues"
23+
},
24+
"boards": [
25+
{
26+
"name": "Arduino Uno WiFi Rev2"
27+
},
28+
{
29+
"name": "Arduino Nano Every"
30+
}
31+
],
32+
"toolsDependencies": [
33+
{
34+
"packager": "arduino",
35+
"name": "avr-gcc",
36+
"version": "7.3.0-atmel3.6.1-arduino5"
37+
},
38+
{
39+
"packager": "arduino",
40+
"name": "avrdude",
41+
"version": "6.3.0-arduino17"
42+
},
43+
{
44+
"packager": "arduino",
45+
"name": "arduinoOTA",
46+
"version": "1.3.0"
47+
}
48+
]
49+
}
50+
],
51+
"tools": []
52+
}
53+
]
54+
}

0 commit comments

Comments
 (0)