Skip to content

Commit

Permalink
packages: add demo writing
Browse files Browse the repository at this point in the history
  • Loading branch information
wirungu committed Apr 22, 2024
1 parent 7a884ec commit fee6526
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,24 @@ jobs:
- name: Push containers with release tag
run: |
coordinatorImg=$(nix run .#containers.push-coordinator -- "$container_registry/contrast/coordinator")
nix run .#containers.push-initializer -- "$container_registry/contrast/initializer"
initializerImg=$(nix run .#containers.push-initializer -- "$container_registry/contrast/initializer")
echo "coordinatorImg=$coordinatorImg" | tee -a "$GITHUB_ENV"
echo "initializerImg=$initializerImg" | tee -a "$GITHUB_ENV"
- name: Add tag to Coordinator image
run: |
front=${coordinatorImg%@*}
back=${coordinatorImg#*@}
echo "coordinatorImgTagged=${front}:${{ inputs.version }}@${back}" | tee -a "$GITHUB_ENV"
- name: Create file with image replacements
run: |
echo "$container_registry/contrast/coordinator:latest=$coordinatorImgTagged" > image-replacements.txt
echo "$container_registry/contrast/initializer:latest=$initializerImg" >> image-replacements.txt
- name: Create portable coordinator resource definitions
run: |
mkdir -p workspace
nix run .#scripts.write-coordinator-yaml -- "${coordinatorImgTagged}" > workspace/coordinator.yml
nix run .#scripts.write-emojivoto-demo -- "./image-replacements.txt" > workspace/emojivoto-demo.yml
zip -r workspace/emojivoto-demo.zip workspace/emojivoto-demo.yml
- name: Update coordinator policy hash
run: |
yq < workspace/coordinator.yml \
Expand All @@ -221,6 +228,7 @@ jobs:
files: |
result-cli/bin/contrast
workspace/coordinator.yml
workspace/emojivoto-demo.zip
- name: Reset temporary changes
run: |
git reset --hard ${{ needs.process-inputs.outputs.WORKING_BRANCH }}
Expand Down
16 changes: 16 additions & 0 deletions packages/scripts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,22 @@ with pkgs;
'';
};

write-emojivoto-demo = writeShellApplication {
name = "write-emojivoto-demo";
runtimeInputs = [
contrast
];
text = ''
imageReplacements=$1
tmpdir=$(mktemp -d)
trap 'rm -rf $tmpdir' EXIT
resourcegen emojivoto -image-replacements="$imageReplacements" "$tmpdir/emojivoto_demo.yml"
cat "$tmpdir/emojivoto_demo.yml"
'';
};

fetch-latest-contrast = writeShellApplication {
name = "fetch-latest-contrast";
runtimeInputs = [
Expand Down

0 comments on commit fee6526

Please sign in to comment.