Skip to content

Commit

Permalink
Problem: v1.3.x testground image not uploaded (#1628)
Browse files Browse the repository at this point in the history
* Problem: v1.3.x testground image not uploaded

Solution:
- port the github workflow

* Apply suggestions from code review

Signed-off-by: yihuang <[email protected]>

---------

Signed-off-by: yihuang <[email protected]>
  • Loading branch information
yihuang authored Oct 9, 2024
1 parent 341006a commit ed5dcee
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Push Testground Image

on:
push:
branches:
- main
- release/**
tags:
- "v*.*.*"

env:
IMAGE_NAME: cronos-testground

jobs:

push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read

steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-24.05
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
with:
name: cronos
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
- name: build and push image
run: |
# login to ghcr.io
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,' | sed -e 's/^v//')
[ "$VERSION" == "main" ] && VERSION=latest
echo "VERSION: $VERSION"
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
echo "IMAGE_ID: $IMAGE_ID"
BUILD_TAG="$(nix eval --raw .#testground-image.imageTag)"
echo "BUILD_TAG: $BUILD_TAG"
docker load -i "$(nix build --no-link --print-out-paths .#testground-image)"
docker run --rm -e TEST_CASE=info $IMAGE_NAME:$BUILD_TAG
docker tag $IMAGE_NAME:$BUILD_TAG $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION

0 comments on commit ed5dcee

Please sign in to comment.