Skip to content

Commit f289dc5

Browse files
committed
[CI] Upgrade pacakaging action
1 parent 1c726ab commit f289dc5

File tree

1 file changed

+12
-186
lines changed

1 file changed

+12
-186
lines changed

.github/workflows/package.yml

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

0 commit comments

Comments
 (0)