diff --git a/.github/workflows/build-cartographer-ws.yaml b/.github/workflows/build-cartographer-ws.yaml index 158707a7..bf2c00cd 100644 --- a/.github/workflows/build-cartographer-ws.yaml +++ b/.github/workflows/build-cartographer-ws.yaml @@ -4,6 +4,8 @@ on: push: branches: - "main" + tags: + - v* paths: - .github/workflows/build-cartographer-ws.yaml - cartographer_ws/docker/Dockerfile @@ -15,15 +17,25 @@ jobs: if: github.repository == 'j3soon/ros2-essentials' runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v3 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - - name: Docker meta + - # Ref: https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-a-registry-using-a-personal-access-token + name: Prepare tag name as environment variable + run: | + # This strips the git ref prefix from the version. + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + # This strips the "v" prefix from the tag name. + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + # This uses the Docker `latest` tag convention. + [ "$VERSION" == "main" ] && VERSION=latest + # Output the environment variable + # Ref: https://stackoverflow.com/a/57989070 + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Docker meta id: meta # Ref: https://github.com/docker/metadata-action uses: docker/metadata-action@v5 @@ -32,15 +44,13 @@ jobs: images: ${{ secrets.DOCKERHUB_USERNAME }}/ros2-cartographer-ws tags: | type=raw,value={{date 'YYYYMMDD'}} - type=raw,value=latest - - - name: Login to Docker Hub + type=raw,value=${{ env.VERSION }} + - name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push + - name: Build and push uses: docker/build-push-action@v4 with: context: cartographer_ws/docker diff --git a/.github/workflows/build-gazebo-world-ws.yaml b/.github/workflows/build-gazebo-world-ws.yaml index 991cf613..6f6278dc 100644 --- a/.github/workflows/build-gazebo-world-ws.yaml +++ b/.github/workflows/build-gazebo-world-ws.yaml @@ -4,6 +4,8 @@ on: push: branches: - "main" + tags: + - v* paths: - .github/workflows/build-gazebo-world-ws.yaml - gazebo_world_ws/docker/Dockerfile @@ -15,11 +17,21 @@ jobs: if: github.repository == 'j3soon/ros2-essentials' runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v3 - - - name: Docker meta + - # Ref: https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-a-registry-using-a-personal-access-token + name: Prepare tag name as environment variable + run: | + # This strips the git ref prefix from the version. + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + # This strips the "v" prefix from the tag name. + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + # This uses the Docker `latest` tag convention. + [ "$VERSION" == "main" ] && VERSION=latest + # Output the environment variable + # Ref: https://stackoverflow.com/a/57989070 + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Docker meta id: meta # Ref: https://github.com/docker/metadata-action uses: docker/metadata-action@v5 @@ -28,15 +40,13 @@ jobs: images: ${{ secrets.DOCKERHUB_USERNAME }}/ros2-gazebo-world-ws tags: | type=raw,value={{date 'YYYYMMDD'}} - type=raw,value=latest - - - name: Login to Docker Hub + type=raw,value=${{ env.VERSION }} + - name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push + - name: Build and push uses: docker/build-push-action@v4 with: context: gazebo_world_ws/docker diff --git a/.github/workflows/build-husky-ws.yaml b/.github/workflows/build-husky-ws.yaml index 620be474..e963e514 100644 --- a/.github/workflows/build-husky-ws.yaml +++ b/.github/workflows/build-husky-ws.yaml @@ -4,6 +4,8 @@ on: push: branches: - "main" + tags: + - v* paths: - .github/workflows/build-husky-ws.yaml - husky_ws/docker/Dockerfile @@ -18,15 +20,25 @@ jobs: if: github.repository == 'j3soon/ros2-essentials' runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v3 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - - name: Docker meta + - # Ref: https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-a-registry-using-a-personal-access-token + name: Prepare tag name as environment variable + run: | + # This strips the git ref prefix from the version. + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + # This strips the "v" prefix from the tag name. + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + # This uses the Docker `latest` tag convention. + [ "$VERSION" == "main" ] && VERSION=latest + # Output the environment variable + # Ref: https://stackoverflow.com/a/57989070 + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Docker meta id: meta # Ref: https://github.com/docker/metadata-action uses: docker/metadata-action@v5 @@ -35,15 +47,13 @@ jobs: images: ${{ secrets.DOCKERHUB_USERNAME }}/ros2-husky-ws tags: | type=raw,value={{date 'YYYYMMDD'}} - type=raw,value=latest - - - name: Login to Docker Hub + type=raw,value=${{ env.VERSION }} + - name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push + - name: Build and push uses: docker/build-push-action@v4 with: context: husky_ws/docker diff --git a/.github/workflows/build-kobuki-ws.yaml b/.github/workflows/build-kobuki-ws.yaml index 7449e031..bc3b697b 100644 --- a/.github/workflows/build-kobuki-ws.yaml +++ b/.github/workflows/build-kobuki-ws.yaml @@ -4,6 +4,8 @@ on: push: branches: - "main" + tags: + - v* paths: - .github/workflows/build-kobuki-ws.yaml - kobuki_ws/docker/Dockerfile @@ -17,15 +19,25 @@ jobs: if: github.repository == 'j3soon/ros2-essentials' runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v3 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - - name: Docker meta + - # Ref: https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-a-registry-using-a-personal-access-token + name: Prepare tag name as environment variable + run: | + # This strips the git ref prefix from the version. + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + # This strips the "v" prefix from the tag name. + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + # This uses the Docker `latest` tag convention. + [ "$VERSION" == "main" ] && VERSION=latest + # Output the environment variable + # Ref: https://stackoverflow.com/a/57989070 + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Docker meta id: meta # Ref: https://github.com/docker/metadata-action uses: docker/metadata-action@v5 @@ -34,15 +46,13 @@ jobs: images: ${{ secrets.DOCKERHUB_USERNAME }}/ros2-kobuki-ws tags: | type=raw,value={{date 'YYYYMMDD'}} - type=raw,value=latest - - - name: Login to Docker Hub + type=raw,value=${{ env.VERSION }} + - name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push + - name: Build and push uses: docker/build-push-action@v4 with: context: kobuki_ws/docker diff --git a/.github/workflows/build-orbslam3-ws.yaml b/.github/workflows/build-orbslam3-ws.yaml index 14d41b13..5c62e9d1 100644 --- a/.github/workflows/build-orbslam3-ws.yaml +++ b/.github/workflows/build-orbslam3-ws.yaml @@ -4,6 +4,8 @@ on: push: branches: - "main" + tags: + - v* paths: - .github/workflows/build-orbslam3-ws.yaml - orbslam3_ws/docker/Dockerfile @@ -15,11 +17,21 @@ jobs: if: github.repository == 'j3soon/ros2-essentials' runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v3 - - - name: Docker meta + - # Ref: https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-a-registry-using-a-personal-access-token + name: Prepare tag name as environment variable + run: | + # This strips the git ref prefix from the version. + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + # This strips the "v" prefix from the tag name. + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + # This uses the Docker `latest` tag convention. + [ "$VERSION" == "main" ] && VERSION=latest + # Output the environment variable + # Ref: https://stackoverflow.com/a/57989070 + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Docker meta id: meta # Ref: https://github.com/docker/metadata-action uses: docker/metadata-action@v5 @@ -28,15 +40,13 @@ jobs: images: ${{ secrets.DOCKERHUB_USERNAME }}/ros2-orbslam3-ws tags: | type=raw,value={{date 'YYYYMMDD'}} - type=raw,value=latest - - - name: Login to Docker Hub + type=raw,value=${{ env.VERSION }} + - name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push + - name: Build and push uses: docker/build-push-action@v4 with: context: orbslam3_ws/docker diff --git a/.github/workflows/build-ros1-bridge-ws.yaml b/.github/workflows/build-ros1-bridge-ws.yaml index f7e33d96..d32dc409 100644 --- a/.github/workflows/build-ros1-bridge-ws.yaml +++ b/.github/workflows/build-ros1-bridge-ws.yaml @@ -4,6 +4,8 @@ on: push: branches: - "main" + tags: + - v* paths: - .github/workflows/build-ros1-bridge-ws.yaml - ros1_bridge_ws/docker/Dockerfile @@ -18,15 +20,25 @@ jobs: runs-on: self-hosted timeout-minutes: 1440 steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v3 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - - name: Docker meta + - # Ref: https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-a-registry-using-a-personal-access-token + name: Prepare tag name as environment variable + run: | + # This strips the git ref prefix from the version. + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + # This strips the "v" prefix from the tag name. + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + # This uses the Docker `latest` tag convention. + [ "$VERSION" == "main" ] && VERSION=latest + # Output the environment variable + # Ref: https://stackoverflow.com/a/57989070 + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Docker meta id: meta # Ref: https://github.com/docker/metadata-action uses: docker/metadata-action@v5 @@ -35,9 +47,8 @@ jobs: images: ${{ secrets.DOCKERHUB_USERNAME }}/ros2-ros1-bridge-ws tags: | type=raw,value={{date 'YYYYMMDD'}} - type=raw,value=latest - - - name: Docker meta (for build) + type=raw,value=${{ env.VERSION }} + - name: Docker meta (for build) id: meta_build # Ref: https://github.com/docker/metadata-action uses: docker/metadata-action@v5 @@ -46,15 +57,13 @@ jobs: images: ${{ secrets.DOCKERHUB_USERNAME }}/ros2-ros1-bridge-build-ws tags: | type=raw,value={{date 'YYYYMMDD'}} - type=raw,value=latest - - - name: Login to Docker Hub + type=raw,value=${{ env.VERSION }} + - name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push + - name: Build and push uses: docker/build-push-action@v4 with: context: ros1_bridge_ws/docker @@ -62,8 +71,7 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} - - - name: Build and push + - name: Build and push uses: docker/build-push-action@v4 with: context: ros1_bridge_ws/docker diff --git a/.github/workflows/build-rtabmap-ws.yaml b/.github/workflows/build-rtabmap-ws.yaml index 48295687..60222fe9 100644 --- a/.github/workflows/build-rtabmap-ws.yaml +++ b/.github/workflows/build-rtabmap-ws.yaml @@ -4,6 +4,8 @@ on: push: branches: - "main" + tags: + - v* paths: - .github/workflows/build-rtabmap-ws.yaml - rtabmap_ws/docker/Dockerfile @@ -15,11 +17,21 @@ jobs: if: github.repository == 'j3soon/ros2-essentials' runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v3 - - - name: Docker meta + - # Ref: https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-a-registry-using-a-personal-access-token + name: Prepare tag name as environment variable + run: | + # This strips the git ref prefix from the version. + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + # This strips the "v" prefix from the tag name. + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + # This uses the Docker `latest` tag convention. + [ "$VERSION" == "main" ] && VERSION=latest + # Output the environment variable + # Ref: https://stackoverflow.com/a/57989070 + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Docker meta id: meta # Ref: https://github.com/docker/metadata-action uses: docker/metadata-action@v5 @@ -28,15 +40,13 @@ jobs: images: ${{ secrets.DOCKERHUB_USERNAME }}/ros2-rtabmap-ws tags: | type=raw,value={{date 'YYYYMMDD'}} - type=raw,value=latest - - - name: Login to Docker Hub + type=raw,value=${{ env.VERSION }} + - name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push + - name: Build and push uses: docker/build-push-action@v4 with: context: rtabmap_ws/docker diff --git a/.github/workflows/build-template-ws.yaml b/.github/workflows/build-template-ws.yaml index 327f8637..d79eb621 100644 --- a/.github/workflows/build-template-ws.yaml +++ b/.github/workflows/build-template-ws.yaml @@ -4,6 +4,8 @@ on: push: branches: - "main" + tags: + - v* paths: - .github/workflows/build-template-ws.yaml - template_ws/docker/Dockerfile @@ -15,15 +17,25 @@ jobs: if: github.repository == 'j3soon/ros2-essentials' runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v3 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - - name: Docker meta + - # Ref: https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-a-registry-using-a-personal-access-token + name: Prepare tag name as environment variable + run: | + # This strips the git ref prefix from the version. + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + # This strips the "v" prefix from the tag name. + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + # This uses the Docker `latest` tag convention. + [ "$VERSION" == "main" ] && VERSION=latest + # Output the environment variable + # Ref: https://stackoverflow.com/a/57989070 + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Docker meta id: meta # Ref: https://github.com/docker/metadata-action uses: docker/metadata-action@v5 @@ -32,15 +44,13 @@ jobs: images: ${{ secrets.DOCKERHUB_USERNAME }}/ros2-template-ws tags: | type=raw,value={{date 'YYYYMMDD'}} - type=raw,value=latest - - - name: Login to Docker Hub + type=raw,value=${{ env.VERSION }} + - name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push + - name: Build and push uses: docker/build-push-action@v4 with: context: template_ws/docker diff --git a/.github/workflows/build-vlp-ws.yaml b/.github/workflows/build-vlp-ws.yaml index f09f4940..e83e082b 100644 --- a/.github/workflows/build-vlp-ws.yaml +++ b/.github/workflows/build-vlp-ws.yaml @@ -4,6 +4,8 @@ on: push: branches: - "main" + tags: + - v* paths: - .github/workflows/build-vlp-ws.yaml - vlp_ws/docker/Dockerfile @@ -15,15 +17,25 @@ jobs: if: github.repository == 'j3soon/ros2-essentials' runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v3 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - - name: Docker meta + - # Ref: https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-a-registry-using-a-personal-access-token + name: Prepare tag name as environment variable + run: | + # This strips the git ref prefix from the version. + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + # This strips the "v" prefix from the tag name. + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + # This uses the Docker `latest` tag convention. + [ "$VERSION" == "main" ] && VERSION=latest + # Output the environment variable + # Ref: https://stackoverflow.com/a/57989070 + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Docker meta id: meta # Ref: https://github.com/docker/metadata-action uses: docker/metadata-action@v5 @@ -32,15 +44,13 @@ jobs: images: ${{ secrets.DOCKERHUB_USERNAME }}/ros2-vlp-ws tags: | type=raw,value={{date 'YYYYMMDD'}} - type=raw,value=latest - - - name: Login to Docker Hub + type=raw,value=${{ env.VERSION }} + - name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push + - name: Build and push uses: docker/build-push-action@v4 with: context: vlp_ws/docker