[script] support multiple config release #19
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: Build Docker Image | |
# Release on any git tag | |
on: | |
push: | |
tags: ['*'] | |
jobs: | |
build: | |
runs-on: [self-hosted, linux, nixos] | |
strategy: | |
matrix: | |
config: | |
- blastoise | |
- machamp | |
- sandslash | |
outputs: | |
cache-key: ${{ steps.build.outputs.cache-key }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# Checkout the triggered tag name | |
ref: ${{ github.ref_name }} | |
- name: Build docker image file | |
id: build | |
run: | | |
closure="$(nix build -L '.#t1.${{ matrix.config }}.release.docker-layers.final-image' --no-link --print-out-paths)" | |
echo "path: $closure" | |
cp "$closure/image.tar" /tmp/t1-image.tar | |
echo "cache-key=$(nix hash file --base32 /tmp/t1-image.tar)" > $GITHUB_OUTPUT | |
nix build -L '.#t1.${{ matrix.config }}.release.doc' --out-link docs | |
- name: Upload to cache | |
uses: actions/cache/save@v4 | |
with: | |
path: /tmp/t1-image.tar | |
key: ${{ steps.build.outputs.cache-key }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: docs-${{ matrix.config }}.pdf | |
path: | | |
docs/*.pdf | |
upload: | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Restore from cache | |
uses: actions/cache/restore@v4 | |
id: cache | |
with: | |
path: /tmp/t1-image.tar | |
fail-on-cache-miss: true | |
key: ${{ needs.build.outputs.cache-key }} | |
- name: Login to GHCR dot IO | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Load and push | |
run: | | |
docker load < /tmp/t1-image.tar | |
docker tag t1/release:latest ghcr.io/chipsalliance/t1:latest | |
docker push ghcr.io/chipsalliance/t1:latest |