diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 630b0c5e..33fa45f7 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,6 +1,8 @@ name: Build on: + repository_dispatch: + types: [fog-ros-baseimage-update] push: jobs: @@ -11,6 +13,19 @@ jobs: - uses: docker/setup-buildx-action@v1 + - name: Set image tag format without suffix + run: | + echo "IMAGE_TAG_FORMAT=type=sha" >> $GITHUB_ENV + if: github.event_name == 'push' + + - name: Set image tag format with suffix + # it is possible that run_number should be used instead run_attempt + # run_attempt is unique number on every run and run_attempt resets to 1 if re-build is not used + # content of image_sha_tag_suffix is defined in fog-ros-baseimage dispatcher workflow. + run: | + echo "IMAGE_TAG_FORMAT=type=sha,suffix=-${{ github.event.client_payload.image_sha_tag_suffix }}" >> $GITHUB_ENV + if: github.event_name == 'repository_dispatch' + - name: Docker meta id: meta uses: docker/metadata-action@v3 @@ -19,8 +34,8 @@ jobs: tags: | type=ref,event=branch type=semver,pattern={{version}} - type=sha type=raw,value=latest + ${{ env.IMAGE_TAG_FORMAT }} - name: Login to GitHub Container Registry uses: docker/login-action@v1 diff --git a/Dockerfile b/Dockerfile index ebc059ea..43648b23 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,8 @@ COPY . /main_ws/src/ # this: # 1) builds the application -# 2) packages the application as .deb & writes it to build_output/ -RUN /packaging/build-and-package-as-deb.sh -o build_output/ +# 2) packages the application as .deb in /main_ws/ +RUN /packaging/build.sh # ▲ runtime ──┐ # └── build ▼ @@ -16,7 +16,7 @@ ENTRYPOINT /entrypoint.sh COPY entrypoint.sh /entrypoint.sh -COPY --from=builder /main_ws/src/build_output/ros-*-rplidar-ros2_*_amd64.deb /rplidar.deb +COPY --from=builder /main_ws/ros-*-rplidar-ros2_*_amd64.deb /rplidar.deb # need update because ROS people have a habit of removing old packages pretty fast RUN apt update && apt install -y ros-${ROS_DISTRO}-tf2-ros \