deploy #434
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: deploy | |
on: | |
workflow_run: | |
workflows: | |
- nix build | |
types: | |
- completed | |
jobs: | |
deploy: | |
name: push | |
runs-on: ubuntu-latest | |
# only run if the previous workflow succeeded, | |
# and only on the `main` branch or version tags | |
if: | | |
github.event.workflow_run.conclusion == 'success' | |
&& (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | |
steps: | |
- name: Checkout ποΈ | |
uses: actions/checkout@v4 | |
- name: Install Nix β | |
uses: cachix/install-nix-action@v24 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up the Nix Cache π | |
uses: cachix/cachix-action@v14 | |
with: | |
name: hasura-v3-dev | |
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | |
useDaemon: false # attempt to stop hanging on cleanup | |
- name: Login to GitHub Container Registry π¦ | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push Docker images to GitHub Packages π’ | |
run: nix run .#publish-docker-image '${{ github.ref }}' 'ghcr.io/hasura/ndc-sqlserver' | |
# scream into Slack if something goes wrong | |
- name: Report Status | |
if: always() | |
uses: ravsamhq/notify-slack-action@v2 | |
with: | |
status: ${{ job.status }} | |
notify_when: failure | |
notification_title: "π§ Error on <{repo_url}|{repo}>" | |
message_format: "π΄ *{workflow}* {status_message} for <{repo_url}|{repo}>" | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.BROKEN_BUILD_SLACK_WEBHOOK_URL }} |