chore: Pull version using cargo for tag job

This commit is contained in:
Gerald Pinder 2024-04-27 15:41:55 -04:00
parent d4160fedd9
commit 232795a932

View file

@ -22,24 +22,14 @@ jobs:
fetch-depth: 0
fetch-tags: true
# There is a bug selecting a satellite in version 0.8
# so we use 0.7 to login and connect to the satellite
# before switching to the latest version
- uses: dtolnay/rust-toolchain@stable
- uses: earthly/actions-setup@v1
with:
version: v0.8.3
- name: Earthly login
run: |
earthly account login --token ${{ secrets.EARTHLY_SAT_TOKEN }} >> /dev/null
earthly org s blue-build
earthly sat s blue-build-tag
- name: Set up Python
uses: actions/setup-python@v5
- name: Add tomlq
run: pip install tomlq
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
@ -50,6 +40,6 @@ jobs:
- name: Run build
run: |
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
CARGO_PACKAGE_VERSION="v$(tomlq '.workspace.package.version' $PWD/Cargo.toml | sed 's/\"//g')"
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