-
Notifications
You must be signed in to change notification settings - Fork 1
205 lines (205 loc) · 6.72 KB
/
package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
---
name: Package mc_panda_lirmm
on:
repository_dispatch:
types:
- package-master
- package-release
pull_request:
branches:
- "**"
push:
paths-ignore:
- README.md
- ".github/workflows/build.yml"
branches:
- "**"
tags:
- v*
jobs:
check-tag:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
if: startsWith(github.ref, 'refs/tags/')
- name: Check version coherency
run: |
set -x
export VERSION=`echo ${{ github.ref }} | sed -e 's@refs/tags/v@@'`
echo "REJECTION=PROJECT_VERSION in CMakeLists.txt does not match tag" >> $GITHUB_ENV
grep -q "project(mc_panda_lirmm .* VERSION ${VERSION}.*)" CMakeLists.txt
echo "REJECTION=Upstream version in debian/changelog does not match tag" >> $GITHUB_ENV
head -n 1 debian/changelog | grep -q "mc-panda (${VERSION}"
echo "REJECTION=" >> $GITHUB_ENV
export TAG=`echo ${{ github.ref }} | sed -e 's@refs/tags/@@'`
echo "RELEASE_TAG=${TAG}" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/')
- name: Delete tag
run: |
set -x
curl --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -X DELETE https://api.github.com/repos/${{ github.repository }}/git/${{ github.ref }}
if: failure()
- name: Notify tag deletion
uses: archive/github-actions-slack@master
with:
slack-bot-user-oauth-access-token: "${{ secrets.SLACK_BOT_TOKEN }}"
slack-channel: "#ci"
slack-text: |
Tag *${{ github.ref }}* in *${{ github.repository }}* was deleted:
${{ env.REJECTION}}
if: failure()
- name: Create release
uses: jrl-umi3218/github-actions/create-release@master
with:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
tag: "${{ env.RELEASE_TAG }}"
if: startsWith(github.ref, 'refs/tags/')
build-packages:
needs: check-tag
strategy:
fail-fast: false
matrix:
dist:
- bionic
- focal
arch:
- amd64
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Choose extra mirror
run: |
# We upload in all conditions except when building on PR or branch other than master
export PACKAGE_UPLOAD=true
if ${{ startsWith(github.ref, 'refs/tags/') }}
then
export USE_HEAD=false
elif [ "${{ github.event.action }}" == "package-master" ]
then
export USE_HEAD=true
elif [ "${{ github.event.action }}" == "package-release" ]
then
export USE_HEAD=false
export REF=`git tag --sort=committerdate --list 'v[0-9]*'|tail -1`
git checkout $REF
git submodule sync && git submodule update
else
export REF=`echo ${{ github.ref }} | sed -e 's@refs/[a-z]*/@@'`
export USE_HEAD=true
if [ $REF != "master" ]
then
export PACKAGE_UPLOAD=false
fi
fi
if $USE_HEAD
then
echo "CLOUDSMITH_REPO=mc-rtc/head" >> $GITHUB_ENV
echo "PACKAGE_JOB=package-master" >> $GITHUB_ENV
else
echo "CLOUDSMITH_REPO=mc-rtc/stable" >> $GITHUB_ENV
echo "PACKAGE_JOB=package-release" >> $GITHUB_ENV
fi
echo "PACKAGE_UPLOAD=${PACKAGE_UPLOAD}" >> $GITHUB_ENV
- name: Setup ROS packages
run: |
set -x
export ROS_PYTHON=python2.7
export ROS_DISTRO=""
if [ "${{ matrix.dist }}" = "xenial" ]
then
export ROS_DISTRO="kinetic"
fi
if [ "${{ matrix.dist }}" = "bionic" ]
then
export ROS_DISTRO="melodic"
fi
if [ "${{ matrix.dist }}" = "focal" ]
then
export ROS_DISTRO="noetic"
export ROS_PYTHON=python3
export MC_LOG_UI_PYTHON_EXECUTABLE=python3
fi
echo "ROS_DISTRO=${ROS_DISTRO}" >> $GITHUB_ENV
sed -i -e"s/@ROS_DISTRO@/${ROS_DISTRO}/g" debian/control
cat debian/control
sed -i -e"s/@ROS_DISTRO@/${ROS_DISTRO}/g" debian/rules
sed -i -e"s/@ROS_PYTHON@/${ROS_PYTHON}/g" debian/rules
cat debian/rules
- name: Build package
uses: jrl-umi3218/github-actions/build-package-native@master
with:
dist: "${{ matrix.dist }}"
arch: "${{ matrix.arch }}"
ros-distro: "${{ env.ROS_DISTRO }}"
cloudsmith-repo: "${{ env.CLOUDSMITH_REPO }}"
- uses: actions/upload-artifact@v1
with:
name: packages-${{ matrix.dist }}-${{ matrix.arch }}
path: "/tmp/packages-${{ matrix.dist }}-${{ matrix.arch }}/"
if: env.PACKAGE_UPLOAD == 'true'
upload-packages:
needs: build-packages
strategy:
max-parallel: 1
fail-fast: false
matrix:
dist:
- bionic
- focal
arch:
- amd64
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Choose extra mirror
run: |
# We upload in all conditions except when building on PR or branch other than master
export PACKAGE_UPLOAD=true
if ${{ startsWith(github.ref, 'refs/tags/') }}
then
export USE_HEAD=false
elif [ "${{ github.event.action }}" == "package-master" ]
then
export USE_HEAD=true
elif [ "${{ github.event.action }}" == "package-release" ]
then
export USE_HEAD=false
export REF=`git tag --sort=committerdate --list 'v[0-9]*'|tail -1`
git checkout $REF
git submodule sync && git submodule update
else
export REF=`echo ${{ github.ref }} | sed -e 's@refs/[a-z]*/@@'`
export USE_HEAD=true
if [ $REF != "master" ]
then
export PACKAGE_UPLOAD=false
fi
fi
if $USE_HEAD
then
echo "CLOUDSMITH_REPO=mc-rtc/head" >> $GITHUB_ENV
echo "PACKAGE_JOB=package-master" >> $GITHUB_ENV
else
echo "CLOUDSMITH_REPO=mc-rtc/stable" >> $GITHUB_ENV
echo "PACKAGE_JOB=package-release" >> $GITHUB_ENV
fi
echo "PACKAGE_UPLOAD=${PACKAGE_UPLOAD}" >> $GITHUB_ENV
- name: Download packages
uses: actions/download-artifact@v1
with:
name: packages-${{ matrix.dist }}-${{ matrix.arch }}
if: env.PACKAGE_UPLOAD == 'true'
- name: Upload
uses: jrl-umi3218/github-actions/upload-package@master
with:
dist: ubuntu/${{ matrix.dist }}
repo: "${{ env.CLOUDSMITH_REPO }}"
path: packages-${{ matrix.dist }}-${{ matrix.arch }}
CLOUDSMITH_API_KEY: "${{ secrets.CLOUDSMITH_API_KEY }}"
if: env.PACKAGE_UPLOAD == 'true'