From 739b933955baa885c8c5c441af2e84ce6d223df8 Mon Sep 17 00:00:00 2001 From: Avimitin Date: Tue, 9 Apr 2024 18:18:43 +0800 Subject: [PATCH] [ci] add release workflow Signed-off-by: Avimitin --- .github/workflows/release.yml | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..ebdded1c05 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,55 @@ +name: Build Docker Image + +# Release on any git tag +on: + push: + tags: ['*'] + # FIXME: remove this after debug done + pull_request: + +jobs: + build: + runs-on: [self-hosted, linux, nixos] + strategy: + matrix: + config: + - blastoise + 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: | + nix build -L '.#t1.${{ matrix.config }}.release.docker-layers.final-image' --out-link layer + echo "cache-key=$(nix hash file --base64 --type sha256 --sri ./layer/image.tar)" > $GITHUB_OUTPUT + - name: Upload to cache + uses: actions/cache/save@v3 + with: + path: layer/image.tar + key: ${{ steps.build.outputs.cache-key }} + + upload: + runs-on: ubuntu-latest + needs: [build] + steps: + - name: Restore from cache + uses: actions/cache/save@v3 + id: cache + with: + path: layer/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 -i layer/image.tar + docker push chipsalliance/t1:latest