test dockerfile #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: | |
- "master" | |
tags: | |
- "*" | |
env: | |
BASE_IMAGE: crosslanguagesoccerframework/rcssserver | |
BASE_TAG: latest | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
name: Build & Push Docker | |
if: startsWith(github.ref, 'refs/tags/') | |
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: 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-${{ github.ref_name }}-${{ 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 | |
# ------------------------------------------- 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-2004.AppImage | |
# ------------------------------------------- Artifact | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rcssserver-x86_64 | |
path: ${{ github.workspace }}/artifact/* | |
retention-days: 5 | |
- name: Check if there is no release with the same tag | |
id: check_release | |
run: | | |
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::${{ steps.check_release.outputs.stdout }}" | |
# ------------------------------------------- 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: "${{ github.ref_name }}" | |
release_name: "${{ github.ref_name }}" | |
release_body: "RoboCup Soccer Simulator Server" | |
draft: false | |
prerelease: false |