Fix image tagging #123
Workflow file for this run
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: Docker | |
on: [push, pull_request] | |
jobs: | |
# set up | |
clean-up: | |
name: Clean up | |
runs-on: self-hosted | |
steps: | |
- name: Clean up | |
run: rm -rf * | |
# create carla-prerequisites image | |
create-carla-prerequisites-image: | |
name: Create carla-prerequisites image | |
runs-on: self-hosted | |
needs: clean-up | |
steps: | |
- uses: docker/build-push-action@v5 | |
name: Build image | |
with: | |
file: Util/Docker/Prerequisites.Dockerfile | |
tags: carla-prerequisites | |
no-cache: true | |
build-args: | | |
EPIC_USER=${{ secrets.EPIC_USER }} | |
EPIC_PASS=${{ secrets.EPIC_PASS }} | |
# create and push carla-source image | |
create-carla-source-image: | |
name: Create carla-source image | |
runs-on: self-hosted | |
needs: create-carla-prerequisites-image | |
env: | |
IMAGE_TAG_SUFFIX: "" | |
steps: | |
- name: Set image tag | |
run: | | |
echo "IMAGE_TAG_SUFFIX=_$(echo '${{ github.ref_name }}' | tr / -)_ci" >> $GITHUB_ENV | |
if: github.ref_name != github.event.repository.default_branch | |
- uses: actions/checkout@v3 | |
name: Checkout repository | |
with: | |
submodules: true | |
- uses: docker/login-action@v3 | |
name: Login to Docker Hub | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- uses: docker/build-push-action@v5 | |
name: Build and push image | |
with: | |
file: Util/Docker/Carla.Dockerfile | |
tags: rwthika/carla-simulator:source${{env.IMAGE_TAG_SUFFIX}} | |
no-cache: true | |
push: false | |
context: . | |
# provide artifacts and releases | |
provide-artifacts: | |
name: Provide carla artifacts | |
runs-on: self-hosted | |
needs: create-carla-source-image | |
env: | |
IMAGE_TAG_SUFFIX: "" | |
steps: | |
- name: Set image tag | |
run: | | |
echo "IMAGE_TAG_SUFFIX=_$(echo '${{ github.ref_name }}' | tr / -)_ci" >> $GITHUB_ENV | |
if: github.ref_name != github.event.repository.default_branch | |
# provide carla-package | |
- uses: shrink/actions-docker-extract@v3 | |
name: Extract carla-package | |
with: | |
image: rwthika/carla-simulator:source${{env.IMAGE_TAG_SUFFIX}} | |
path: home/carla/carla/Dist | |
destination: artifacts/ | |
# provide carla-python-api | |
- uses: shrink/actions-docker-extract@v3 | |
name: Extract carla-python-api | |
id: extract_python_api | |
with: | |
image: rwthika/carla-simulator:source${{env.IMAGE_TAG_SUFFIX}} | |
path: home/carla/carla/PythonAPI | |
destination: artifacts/ | |
# create archive for release | |
- name: Create archive | |
if: startsWith(github.ref, 'refs/tags') | |
run: tar -czvf artifacts/PythonAPI.tar.gz artifacts/PythonAPI | |
# provide release | |
- uses: ncipollo/release-action@v1 | |
name: Create Release | |
if: startsWith(github.ref, 'refs/tags') | |
with: | |
allowUpdates: true | |
tag: ${{ github.ref_name }} | |
commit: ${{ github.sha }} | |
artifacts: artifacts/PythonAPI.tar.gz | |
token: ${{ secrets.PAT }} | |
# create vulkan-base for carla release | |
create-vulkan-base-image: | |
name: Create vulkan-base image | |
runs-on: self-hosted | |
needs: provide-artifacts | |
steps: | |
- uses: docker/build-push-action@v5 | |
name: Build image | |
with: | |
file: Util/Docker/vulkan-base/Vulkan.Dockerfile | |
tags: vulkan-base | |
no-cache: true | |
build-args: | | |
BASE_DIST=ubuntu22.04 | |
CUDA_VERSION=12.2.0 | |
context: Util/Docker/vulkan-base | |
# create and push carla image | |
create-carla-image: | |
name: Create carla image | |
runs-on: self-hosted | |
needs: create-vulkan-base-image | |
env: | |
IMAGE_TAG_SUFFIX: "" | |
steps: | |
- name: Set image tag | |
run: | | |
echo "IMAGE_TAG_SUFFIX=_$(echo '${{ github.ref_name }}' | tr / -)_ci" >> $GITHUB_ENV | |
if: github.ref_name != github.event.repository.default_branch | |
- uses: docker/login-action@v3 | |
name: Login to Docker Hub | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Extract artifact | |
run: mkdir -p build && tar -xvzf artifacts/Dist/*.tar.gz -C build | |
- uses: docker/build-push-action@v5 | |
name: Build and push | |
with: | |
file: build/Dockerfile | |
tags: rwthika/carla-simulator:latest${{env.IMAGE_TAG_SUFFIX}} | |
no-cache: true | |
context: build | |
push: true |