chore: Improve tagging of images and applying labels

This commit is contained in:
Gerald Pinder 2024-04-28 21:21:54 -04:00
parent 0b5e7599f8
commit 83d654d3a2
5 changed files with 101 additions and 72 deletions

View file

@ -15,7 +15,7 @@ jobs:
timeout-minutes: 60
runs-on: ubuntu-latest
outputs:
export: ${{ steps.build.outputs.export }}
push: ${{ steps.build.outputs.push }}
steps:
- name: Maximize build space
@ -33,7 +33,7 @@ jobs:
run: |
earthly account login --token ${{ secrets.EARTHLY_SAT_TOKEN }} >> /dev/null
earthly org s blue-build
earthly sat s blue-build-pr
earthly sat s pr
- uses: actions/checkout@v4
with:
@ -53,10 +53,11 @@ jobs:
id: build
run: |
if [ -n "${{ github.token }}" ]; then
earthly --ci --push +build-scripts
echo "export=true" >> "$GITHUB_OUTPUT"
earthly --ci --push +build
echo "push=true" >> "$GITHUB_OUTPUT"
else
earthly --ci +build
fi
earthly --ci +build
integration-tests:
permissions:
@ -65,7 +66,7 @@ jobs:
runs-on: ubuntu-latest
needs:
- build
if: needs.build.outputs.export == 'true'
if: needs.build.outputs.push == 'true'
steps:
- name: Maximize build space
@ -104,7 +105,7 @@ jobs:
id-token: write
needs:
- build
if: needs.build.outputs.export == 'true'
if: needs.build.outputs.push == 'true'
steps:
- name: Maximize build space
@ -125,7 +126,7 @@ jobs:
run: |
earthly account login --token ${{ secrets.EARTHLY_SAT_TOKEN }} >> /dev/null
earthly org s blue-build
earthly sat s blue-build-pr
earthly sat s pr
- uses: actions/checkout@v4
with:

View file

@ -36,7 +36,7 @@ jobs:
run: |
earthly account login --token ${{ secrets.EARTHLY_SAT_TOKEN }} >> /dev/null
earthly org s blue-build
earthly sat s blue-build-main
earthly sat s main
# Setup repo and add caching
- uses: actions/checkout@v4
@ -124,7 +124,7 @@ jobs:
run: |
earthly account login --token ${{ secrets.EARTHLY_SAT_TOKEN }} >> /dev/null
earthly org s blue-build
earthly sat s blue-build-main
earthly sat s main
- uses: actions/checkout@v4
with:

View file

@ -28,7 +28,7 @@ jobs:
run: |
earthly account login --token ${{ secrets.EARTHLY_SAT_TOKEN }} >> /dev/null
earthly org s blue-build
earthly sat s blue-build-tag
earthly sat s tag
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
@ -42,4 +42,4 @@ jobs:
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
CARGO_PACKAGE_VERSION="v$(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name == "blue-build") .version')"
LATEST=$(test "$CARGO_PACKAGE_VERSION" = "$LATEST_TAG" && echo true || echo false)
earthly --push --ci -P +all --TAG=$LATEST_TAG --LATEST=$LATEST
earthly --push --ci -P +all --TAGGED="true" --LATEST="$LATEST"