v0.19.1 SkillsForge & SchemaForge #41
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
release: | |
types: | |
- created | |
env: | |
IMAGE_NAME: ghcr.io/kreneskyp/ix/sandbox | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
# setup | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Load image urls | |
id: load_image_url | |
run: | | |
IMAGE_URL=`make image-url` | |
IMAGE_URL_NODEJS=`make image-url-nodejs` | |
echo "image-url=$IMAGE_URL" >> "$GITHUB_OUTPUT" | |
echo "image-url-nodejs=$IMAGE_URL_NODEJS" >> "$GITHUB_OUTPUT" | |
# attempt to load both images from cache | |
- name: Restore Sandbox Image Cache | |
uses: actions/cache@v3 | |
id: restore_cache | |
with: | |
path: image.tar | |
key: ${{ steps.load_image_url.outputs.image-url }} | |
- name: load image | |
if: steps.restore_cache.outputs.cache-hit == 'true' | |
shell: bash | |
run: | | |
docker load --input image.tar | |
docker tag ${{ steps.load_image_url.outputs.image-url }} ghcr.io/kreneskyp/ix/sandbox:latest | |
- name: Restore NodeJS Image Cache | |
uses: actions/cache@v3 | |
id: restore_cache_nodejs | |
with: | |
path: image-nodejs.tar | |
key: ${{ steps.load_image_url.outputs.image-url-nodejs }} | |
- name: load nodejs image | |
if: steps.restore_cache_nodejs.outputs.cache-hit == 'true' | |
shell: bash | |
run: | | |
docker load --input image-nodejs.tar | |
docker tag ${{ steps.load_image_url.outputs.image-url-nodejs }} ghcr.io/kreneskyp/ix/nodejs:latest | |
# build images - Both images must be built locally a because it's needed to build the frontend. | |
# The cache wasn't working reliably across workflows, so it must be built here. This | |
# build is not multi-platform since it is needed locally. | |
- name: Build Sandbox image | |
id: build | |
if: steps.restore_cache.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p .sentinel | |
IMAGE_URL=`make image-url` | |
echo "Building Sandbox Docker image: $IMAGE_URL" | |
make image | |
- name: Build NodeJS image | |
id: build-nodejs | |
if: steps.restore_cache_nodejs.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p .sentinel | |
IMAGE_URL_NODEJS=`make image-url-nodejs` | |
echo "Building NodeJS Docker image: $IMAGE_URL_NODEJS" | |
make nodejs | |
# transpile javascript frontend - output will be added to image | |
- name: run | |
shell: bash | |
env: | |
NO_IMAGE_BUILD: 1 | |
run: | | |
touch .env | |
make frontend | |
# docker multi-platform build + publish | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
ghcr.io/kreneskyp/ix/sandbox:latest | |
ghcr.io/kreneskyp/ix/sandbox:${{ github.event.release.tag_name }} |