195 panther add collision monitoring to the panther #218
This file contains hidden or 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
# SPDX-FileCopyrightText: Alliander N. V. | |
# | |
# SPDX-License-Identifier: Apache-2.0 | |
name: docker-and-workspace | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
check-run-destination: | |
runs-on: ubuntu-latest | |
outputs: | |
destination: ${{ steps.check-run-destination.outputs.destination }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: check-run-destination | |
if: ${{ !env.ACT }} | |
run: | | |
echo "Workflow is running on Github." | |
echo "destination=Github" >> "$GITHUB_OUTPUT" | |
get-current-branch: | |
needs: check-run-destination | |
runs-on: ubuntu-latest | |
outputs: | |
branch: ${{ steps.get-current-branch.outputs.branch }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: get-current-branch | |
run: | | |
if [ "${{ needs.check-run-destination.outputs.destination }}" == "Github" ] ; then | |
echo "branch=${GITHUB_HEAD_REF/\//-}" >> "$GITHUB_OUTPUT" | |
else | |
echo "branch=$(git branch --show-current)" >> "$GITHUB_OUTPUT" | |
fi | |
get-image-tag: | |
needs: get-current-branch | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.get-image-tag.outputs.tag }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: get-image-tag | |
run: | | |
current_branch=${{ needs.get-current-branch.outputs.branch }} | |
echo "tag=$(. ./get_image_tag ${current_branch})" >> "$GITHUB_OUTPUT" | |
docker: | |
needs: get-image-tag | |
if: ${{ ((needs.get-image-tag.outputs.tag != 'latest') || (github.event_name == 'push')) && (needs.check-run-destination.outputs.destination == 'Github') }} | |
uses: ./.github/workflows/reusable-docker.yml | |
with: | |
container-image: rcdt/robotics:${{ needs.get-image-tag.outputs.tag }} | |
secrets: inherit | |
workspace: | |
needs: [get-image-tag, docker] | |
if: always() | |
uses: ./.github/workflows/reusable-workspace.yml | |
with: | |
container-image: rcdt/robotics:${{ needs.get-image-tag.outputs.tag }} |