From c75ebd46f49b6ed7ac7327f2e7eb1faa486d70e5 Mon Sep 17 00:00:00 2001 From: Ian Chamberlain Date: Sun, 3 Dec 2023 19:25:55 -0500 Subject: [PATCH] Tag images based on updater API --- .github/workflows/build.yml | 31 +++++++++++++++++++++++-------- download.sh | 21 ++++++++++++++++----- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 07966c0..21a072a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,13 +10,13 @@ jobs: build: name: Build runs-on: ubuntu-latest - + steps: - name: Checkout uses: actions/checkout@v3 with: fetch-depth: 0 - + - name: Login to GitHub Container Registry run: | echo $GITHUB_TOKEN | docker login ghcr.io -u SteamDeckHomebrew --password-stdin @@ -24,10 +24,12 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Download SteamOS - run: ./download.sh + id: download + run: ./download.sh >>$GITHUB_OUTPUT - - name: Build base image - run: sudo ./build.sh + - name: Build and tag base image + run: | + sudo ./build.sh - name: Cleanup SteamOS image run: rm -rf ./steamos_image ./steamos @@ -42,19 +44,32 @@ jobs: cd languages docker build -t ghcr.io/steamdeckhomebrew/holo-toolchain-go:latest -f ./go.dockerfile . + - name: Tag all images + run: | + for tag in \ + "${{ steps.download.outputs.BUILD_ID }}" \ + "${{ steps.download.outputs.FULL_VERSION }}" \ + "${{ steps.download.outputs.MAJOR_VERSION }}" \ + "${{ steps.download.outputs.MINOR_VERSION }}" + do + docker tag ghcr.io/steamdeckhomebrew/holo-base:latest ghcr.io/steamdeckhomebrew/holo-base:$tag + docker tag ghcr.io/steamdeckhomebrew/holo-toolchain-rust:latest ghcr.io/steamdeckhomebrew/holo-toolchain-rust:$tag + docker tag ghcr.io/steamdeckhomebrew/holo-toolchain-go:latest ghcr.io/steamdeckhomebrew/holo-toolchain-go:$tag + done + - name: Wait for other runs to complete uses: softprops/turnstyle@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Push Base image - run: docker push ghcr.io/steamdeckhomebrew/holo-base:latest + run: docker push --all-tags ghcr.io/steamdeckhomebrew/holo-base - name: Push Rust toolchain image - run: docker push ghcr.io/steamdeckhomebrew/holo-toolchain-rust:latest + run: docker push --all-tags ghcr.io/steamdeckhomebrew/holo-toolchain-rust - name: Push Go toolchain image - run: docker push ghcr.io/steamdeckhomebrew/holo-toolchain-go:latest + run: docker push --all-tags ghcr.io/steamdeckhomebrew/holo-toolchain-go:latest - name: Log out of GitHub Container Registry run: | diff --git a/download.sh b/download.sh index 57df19c..f592c1e 100755 --- a/download.sh +++ b/download.sh @@ -3,8 +3,19 @@ set -e # these are hardcoded and can be found in ~/.netrc AUTH="jupiter-image-2021:e54fe7f0-756e-46e1-90d2-7843cda0ac01" -FILE=$(curl -sS --user $AUTH "https://steamdeck-atomupd.steamos.cloud/updates?product=steamos&release=holo&variant=steamdeck&arch=amd64&version=snapshot&buildid=20220526.1&checkpoint=False&estimated_size=0" | jq -r ".minor.candidates[0].update_path" | sed 's/\.raucb/\.img.zip/') -echo "Downloading image $FILE" -curl --user $AUTH "https://steamdeck-images.steamos.cloud/$FILE" -o ./steamos.zip -unzip ./steamos.zip -d ./steamos_image -rm ./steamos.zip \ No newline at end of file +IMAGE="$(curl -sS --user $AUTH "https://steamdeck-atomupd.steamos.cloud/updates?product=steamos&release=holo&variant=steamdeck&arch=amd64&version=snapshot&buildid=20220526.1&checkpoint=False&estimated_size=0" | jq -r '.minor.candidates[0]')" +FILE=$(echo "$IMAGE" | jq -r ".update_path" | sed 's/\.raucb/\.img.zip/') + +{ + echo "Downloading image $FILE" + curl --user $AUTH "https://steamdeck-images.steamos.cloud/$FILE" -o ./steamos.zip + unzip ./steamos.zip -d ./steamos_image + rm ./steamos.zip +} >&2 + +# Output the downloaded version for github actions to tag the images +echo "BUILD_ID=$(echo "$IMAGE" | jq -r '.image.buildid')" +FULL_VERSION="$(echo "$IMAGE" | jq -r '.image.version')" +echo "$FULL_VERSION=${FULL_VERSION}" +echo "MAJOR_VERSION=$(echo "$FULL_VERSION" | cut -d. -f 1)" +echo "MINOR_VERSION=$(echo "$FULL_VERSION" | cut -d. -f 1,2)"