Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions .github/workflows/update_ci_image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
trigger: ${{ steps.check.outputs.trigger }}
no_cache: ${{ steps.check.outputs.no_cache }}
container:
image: ghcr.io/ros-planning/navigation2:${{ github.ref_name }}
image: ghcr.io/${{ github.repository }}:${{ github.ref_name }}
steps:
- name: "Check apt updates"
id: check
Expand Down Expand Up @@ -76,6 +76,8 @@ jobs:
run: |
timestamp=$(date --utc +%Y%m%d%H%M%S)
echo "timestamp=${timestamp}" >> $GITHUB_OUTPUT
datestamp=$(date --utc +%Y%m)
echo "datestamp=${datestamp}" >> $GITHUB_OUTPUT

no_cache=false
if [ "${{needs.check_ci_files.outputs.no_cache}}" == 'true' ] || \
Expand All @@ -100,12 +102,32 @@ jobs:
pull: true
push: true
no-cache: ${{ steps.config.outputs.no_cache }}
cache-from: type=registry,ref=ghcr.io/ros-planning/navigation2:${{ github.ref_name }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:${{ github.ref_name }}
cache-to: type=inline
target: builder
tags: |
ghcr.io/ros-planning/navigation2:${{ github.ref_name }}
ghcr.io/ros-planning/navigation2:${{ github.ref_name }}-${{ steps.config.outputs.timestamp }}
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
ghcr.io/${{ github.repository }}:${{ github.ref_name }}-${{ steps.config.outputs.timestamp }}
- name: Image digest
if: steps.config.outputs.trigger == 'true'
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Delete '${{ github.ref_name }}' images newer than a month
uses: snok/container-retention-policy@v2
with:
image-names: ${{ github.event.repository.name }}
filter-tags: ${{ github.ref_name }}-${{ steps.config.outputs.datestamp }}*
cut-off: now UTC
account-type: org
org-name: ${{ github.repository_owner }}
keep-at-least: 1
token: ${{ secrets.GHCR_PAT }}
- name: Delete '${{ github.ref_name }}' images older than a month
uses: snok/container-retention-policy@v2
with:
image-names: ${{ github.event.repository.name }}
filter-tags: ${{ github.ref_name }}-*
cut-off: A month ago UTC
account-type: org
org-name: ${{ github.repository_owner }}
keep-at-least: 12
token: ${{ secrets.GHCR_PAT }}