Fix image tagging #130
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: | |
clean-up: | |
name: Clean up | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clean up | |
run: rm -rf * | |
create-image: | |
name: Create docker image | |
runs-on: ubuntu-latest | |
needs: clean-up | |
env: | |
IMAGE_TAG_SUFFIX: "" | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout repository | |
with: | |
path: carla-scenario-runner | |
submodules: true | |
- uses: docker/login-action@v3 | |
name: Login to Docker Hub | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- uses: robinraju/[email protected] | |
name: Download PythonAPI | |
with: | |
repository: carla-compose/carla-simulator | |
latest: true | |
fileName: PythonAPI.tar.gz | |
extract: true | |
out-file-path: . | |
- name: Remove PythonAPI.tar.gz | |
run: rm PythonAPI.tar.gz | |
- 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/build-push-action@v5 | |
name: Build and push | |
with: | |
push: true | |
file: carla-scenario-runner/docker/Dockerfile | |
tags: rwthika/carla-scenario-runner:latest${{env.IMAGE_TAG_SUFFIX}} | |
no-cache: true | |
context: . |