-
Notifications
You must be signed in to change notification settings - Fork 1
94 lines (91 loc) · 3.71 KB
/
snap-creation.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
name: Webots Snap Package Creation
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
schedule:
- cron: "0 23 * * *"
push:
tags:
- '*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
build:
if: ${{ github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'test creation') }}
strategy:
matrix:
branch: [master, develop]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Install Snapcraft
uses: samuelmeuli/action-snapcraft@v1
- name: Clone Webots Repository (build)
run: |
sudo apt install --yes git
sudo snap install snapcraft --classic
git clone --recurse-submodules --depth 3 --single-branch --branch ${{ matrix.branch }} https://github.com/cyberbotics/webots.git
export WEBOTS_VERSION=$(cat webots/scripts/packaging/webots_version.txt | sed 's/ revision /-rev/g')
sed -i "s/version:\s*'R[0-9]\{4\}[a-z].*'/version: '$WEBOTS_VERSION'/g" snapcraft.yaml
sed -i "s/set-version\s*R[0-9]\{4\}[a-z].*/set-version $WEBOTS_VERSION/g" snapcraft.yaml
- name: Set Commit SHA in Version
if: ${{ github.event_name == 'schedule' }}
run: python webots/scripts/packaging/set_commit_and_date_in_version.py ${{ github.sha }}
- name: Setup Xvfb
run: |
sudo apt install xvfb
export DISPLAY=:99
Xvfb :99 -screen 0 1024x768x16 &
- name: Create Snap Package
run: |
sudo snapcraft --destructive-mode
cp *.snap webots/distribution
- uses: actions/upload-artifact@v2
if: ${{ contains(github.event.pull_request.labels.*.name, 'test creation') }}
with:
name: build-${{ matrix.branch }}
path: |
webots/distribution/*.snap
- name: Create/Update `webots` GitHub Release
if: ${{ github.event_name == 'schedule' }}
run: |
export COMMIT_ID=$(cd webots; git rev-parse HEAD)
sudo python -m pip install pip --upgrade
sudo python -m pip install requests PyGithub
sudo python -m pip install pyopenssl --upgrade
webots/scripts/packaging/publish_release.py --key=${{ secrets.BOT_ACTION_KEY }} --repo=cyberbotics/webots --commit=$COMMIT_ID
release-tag:
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Install Snapcraft
uses: samuelmeuli/action-snapcraft@v1
- name: Clone Webots Repository (release-tag)
run: |
sudo apt install --yes git
sudo snap install snapcraft --classic
export ROS_DISTRO=noetic
git clone --recurse-submodules --depth 3 --single-branch --branch ${GITHUB_REF#refs/tags/} https://github.com/cyberbotics/webots.git
export WEBOTS_VERSION=$(cat webots/scripts/packaging/webots_version.txt | sed 's/ revision /-rev/g')
sed -i "s/version:\s*'R[0-9]\{4\}[a-z].*'/version: '$WEBOTS_VERSION'/g" snapcraft.yaml
- name: Setup Xvfb
run: |
sudo apt install xvfb
export DISPLAY=:99
Xvfb :99 -screen 0 1024x768x16 &
- name: Create Snap Package
run: |
sudo snapcraft --destructive-mode
cp *.snap webots/distribution
- name: Create/Update `webots` GitHub Release
run: |
export COMMIT_ID=$(cd webots; git rev-parse HEAD)
sudo python -m pip install pip --upgrade
sudo python -m pip install requests PyGithub
sudo python -m pip install pyopenssl --upgrade
webots/scripts/packaging/publish_release.py --key=${{ secrets.BOT_ACTION_KEY }} --repo=cyberbotics/webots --branch=${{ github.ref }} --commit=$COMMIT_ID --tag=${{ github.ref }}