forked from rcsoccersim/rcssserver
-
Notifications
You must be signed in to change notification settings - Fork 2
129 lines (108 loc) · 4.5 KB
/
main.yml
File metadata and controls
129 lines (108 loc) · 4.5 KB
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
name: ci
on:
workflow_dispatch:
push:
branches:
- "master"
tags:
- "*"
env:
BASE_IMAGE: crosslanguagesoccerframework/rcssserver
BASE_TAG: latest
jobs:
docker:
runs-on: ubuntu-latest
name: Build & Push Docker
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Find CMakeLists.txt version
id: cmake_version
run: |
cmake_version=$(grep -oP 'project\(.* VERSION \K[0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt)
echo "::set-output name=version::${cmake_version}"
- name: Check if the version tag exist git then skip
id: check_tag
run: |
git tag -l | grep -q "${{ steps.cmake_version.outputs.version }}" && echo "Tag already exists" && exit 1 || echo "Tag does not exist"
continue-on-error: true
- name: tag the version
if: steps.check_tag.outcome == 'success'
run: |
git config --global user.email "action@github.com"
git config --global user.name "GitHub Action"
git tag -a "${{ steps.cmake_version.outputs.version }}" -m "Version ${{ steps.cmake_version.outputs.version }}"
git push origin "${{ steps.cmake_version.outputs.version }}"
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push RCSSServer
uses: docker/build-push-action@v5
with:
context: .
file: ./utils/docker/Dockerfile
push: true
tags: "${{ env.BASE_IMAGE }}:latest,${{ env.BASE_IMAGE }}:ubuntu-24-${{ steps.cmake_version.outputs.version }}"
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ env.BASE_IMAGE }}
readme-filepath: utils/docker/README.md
short-description: "RoboCup Soccer Simulator Server"
app-image:
runs-on: ubuntu-latest
name: Build AppImage
steps:
- uses: actions/checkout@v4
- name: Create release folder
run: |
mkdir -p ${{ github.workspace }}/artifact
- name: Find CMakeLists.txt version
id: cmake_version
run: |
cmake_version=$(grep -oP 'project\(.* VERSION \K[0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt)
echo "::set-output name=version::${cmake_version}"
# ------------------------------------------- Ubuntu 20.04 AppImage
- name: Prepare builder image for 20.04
run: |
docker build -t builder-image:2004 -f ./utils/appimage/Dockerfile.builder-2004 .
- name: Build app image on 20.04
run: |
docker run --privileged --name builder-2004 \
builder-image:2004 /rcssserver/utils/appimage/build_appimage.sh
docker cp builder-2004:/rcssserver-x86_64.AppImage ${{ github.workspace }}/artifact/rcssserver-x86_64-${{ steps.cmake_version.outputs.version }}.AppImage
# ------------------------------------------- Artifact
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: rcssserver-x86_64
path: ${{ github.workspace }}/artifact/*
retention-days: 5
- name: List files in artifact directory
run: ls -l ${{ github.workspace }}/artifact/
- name: Check if there is no release with the same tag
id: check_release
run: |
result=$(curl -s -o /dev/null -w "%{http_code}" https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ github.ref_name }} -u ${{ secrets.GITHUB_TOKEN }})
echo "::set-output name=release_exists::$result"
# ------------------------------------------- Release
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
if: steps.check_release.outputs.release_exists == '404'
with:
artifacts: "${{ github.workspace }}/artifact/*"
token: ${{ secrets.GITHUB_TOKEN }}
tag: "${{ steps.cmake_version.outputs.version }}"
release_name: "${{ steps.cmake_version.outputs.version }}"
release_body: "RoboCup Soccer Simulator Server"
draft: false
prerelease: false