diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 630b0c5e..e29e424d 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,18 @@ 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 + run: | + echo "IMAGE_TAG_FORMAT=type=sha,suffix=-${{ github.event.client_payload.run_attempt }}" >> $GITHUB_ENV + if: github.event_name == 'repository_dispatch' + - name: Docker meta id: meta uses: docker/metadata-action@v3 @@ -19,8 +33,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..59e163ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ 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/ +RUN /packaging/build.sh # ▲ runtime ──┐ # └── build ▼