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-depth: 0
fetch-tags: true fetch-tags: true
# There is a bug selecting a satellite in version 0.8 - uses: dtolnay/rust-toolchain@stable
# so we use 0.7 to login and connect to the satellite
# before switching to the latest version
- uses: earthly/actions-setup@v1 - uses: earthly/actions-setup@v1
with:
version: v0.8.3
- name: Earthly login - name: Earthly login
run: | run: |
earthly account login --token ${{ secrets.EARTHLY_SAT_TOKEN }} >> /dev/null earthly account login --token ${{ secrets.EARTHLY_SAT_TOKEN }} >> /dev/null
earthly org s blue-build earthly org s blue-build
earthly sat s blue-build-tag 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 - name: Login to GitHub Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
@ -50,6 +40,6 @@ jobs:
- name: Run build - name: Run build
run: | run: |
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) 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) 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 --TAG=$LATEST_TAG --LATEST=$LATEST