Skip to content

Commit

Permalink
Tag images based on updater API
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-h-chamberlain committed Dec 4, 2023
1 parent 97aad61 commit c75ebd4
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 13 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,26 @@ 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
env:
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
Expand All @@ -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: |
Expand Down
21 changes: 16 additions & 5 deletions download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
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)"

0 comments on commit c75ebd4

Please sign in to comment.