Fix error message in notifications and truncate container image text #357
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 | |
on: | |
pull_request: | |
workflow_call: | |
outputs: | |
image_tag: | |
description: The tag for the built image | |
value: ${{ jobs.build.outputs.image_tag }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
image_tag: ${{ steps.build.outputs.image_tag }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v20 | |
- uses: cachix/cachix-action@v12 | |
with: | |
name: tstr | |
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
- name: Validate generated code is up to date | |
run: | | |
nix develop -c dev/up | |
nix develop -c dev/gen | |
nix develop -c dev/down | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "There is outdated generated code. Please regenerate with `dev/gen`."; | |
git status | |
exit 1 | |
fi | |
- name: Build container image | |
id: build | |
run: | | |
nix build .#image | |
echo "image_tag=$(nix eval --raw .#image.imageTag)" >> $GITHUB_OUTPUT | |
- name: Upload built image | |
uses: actions/upload-artifact@v3 | |
with: | |
name: image | |
path: result | |
push: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/main' | |
outputs: | |
image_tag: ${{ steps.push.outputs.image_tag }} | |
steps: | |
- name: Download built image | |
uses: actions/download-artifact@v3 | |
with: | |
name: image | |
- name: Load container image | |
run: "docker load < result" | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: nanzhong | |
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} | |
- name: Push container image | |
id: push | |
run: | | |
docker push "nanzhong/tstr:${{ needs.build.outputs.image_tag }}" | |
echo "image_tag=${{ needs.build.outputs.image_tag }}" >> $GITHUB_OUTPUT |