Skip to content

Commit

Permalink
add heighliner push (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
2xburnt authored Oct 3, 2024
1 parent 9fe2c95 commit 0cb5721
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
with:
distribution: goreleaser
version: "~> v2"
args: build --clean --id xiond_${{ matrix.os }}_${{ matrix.arch }}
args: build --clean --skip validate --id xiond_${{ matrix.os }}_${{ matrix.arch }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
94 changes: 94 additions & 0 deletions .github/workflows/heighliner-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Push Heighliner images

# reusable workflow, do not add triggers
on:
workflow_call:
workflow_dispatch:

env:
REPO: ghcr.io/${{ github.repository }}/heighliner

jobs:
merge:
name: Create registry manifests
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
packages: write
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
role-to-assume: ${{ secrets.AWS_OIDC_ROLE }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Prepare environment
run: |
echo "TAG_VERSION=${GITHUB_SHA:0:7}" | tee -a $GITHUB_ENV
- name: Metadata for xion container
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REPO }}
tags: |
type=raw,value=${{ env.TAG_VERSION }}
type=semver,pattern={{version}},enable=${{ github.event_name == 'push' }}
type=raw,value=latest,enable={{is_default_branch}}
- name: Download images
uses: actions/download-artifact@v4
with:
path: ${{ runner.temp }}
pattern: heighliner*
merge-multiple: true

- name: Load images
working-directory: ${{ runner.temp }}
run: |
for image in heighliner*.tar; do
PLATFORM=$(basename $image .tar | cut -d- -f2-)
docker load < $image;
docker tag heighliner:$PLATFORM ${REPO}:$PLATFORM
docker push ${REPO}:$PLATFORM;
done;
- name: Prepare mainfest vars
run: |
IMAGE_TARGETS=$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< $DOCKER_METADATA_OUTPUT_JSON)
IMAGE_TAGS=$(docker image ls $REPO --digests --format json | jq -r '"\(.Repository):\(.Tag)"' | tr '\n' ' ')
echo "IMAGE_TAGS=$IMAGE_TAGS" | tee -a $GITHUB_ENV
echo "IMAGE_TARGETS=${IMAGE_TARGETS}" | tee -a $GITHUB_ENV
- name: Create manifest list and push
run: |
eval "docker buildx imagetools create ${IMAGE_TARGETS} ${IMAGE_TAGS}"
- name: Inspect image
run: |
jq -cr '.tags | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON" | \
xargs -n1 docker buildx imagetools inspect%

0 comments on commit 0cb5721

Please sign in to comment.