-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9194d6d
commit fd95ab6
Showing
7 changed files
with
209 additions
and
168 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,51 @@ | ||
name: SQLServer NDC build and deploy with Nix | ||
name: multi-architecture docker build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- djh/multi-arch-build | ||
tags: | ||
- 'v*' | ||
- "v*" | ||
|
||
jobs: | ||
binary: | ||
name: deploy::binary | ||
build_and_deploy: | ||
name: build and deploy | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
connector: | ||
- ndc-sqlserver | ||
fail-fast: false | ||
permissions: | ||
contents: read | ||
id-token: write | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Nix ❄ | ||
uses: DeterminateSystems/nix-installer-action@v4 | ||
uses: DeterminateSystems/nix-installer-action@v6 | ||
|
||
- name: Run the Magic Nix Cache 🔌 | ||
uses: DeterminateSystems/magic-nix-cache-action@v2 | ||
|
||
- name: Login to GitHub Container Registry 📦 | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: build the crate using nix 🔨 | ||
run: nix build --print-build-logs | ||
|
||
- name: Create release 🚀 | ||
uses: actions/upload-artifact@v3 | ||
- id: gcloud-auth | ||
name: Authenticate to Google Cloud 🔑 | ||
uses: google-github-actions/auth@v1 | ||
with: | ||
name: hasura-sqlserver-agent-rs | ||
path: result/bin/ndc-sqlserver | ||
token_format: access_token | ||
service_account: "[email protected]" | ||
workload_identity_provider: "projects/1025009031284/locations/global/workloadIdentityPools/hasura-ddn/providers/github" | ||
|
||
# scream into Slack if something goes wrong | ||
- name: Report Status | ||
if: always() | ||
uses: ravsamhq/notify-slack-action@v2 | ||
- name: Login to Google Container Registry 📦 | ||
uses: "docker/login-action@v3" | ||
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 }} | ||
|
||
docker: | ||
name: deploy::docker | ||
needs: binary | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Nix ❄ | ||
uses: DeterminateSystems/nix-installer-action@v4 | ||
|
||
- name: Run the Magic Nix Cache 🔌 | ||
uses: DeterminateSystems/magic-nix-cache-action@v2 | ||
registry: "us-docker.pkg.dev" | ||
username: "oauth2accesstoken" | ||
password: "${{ steps.gcloud-auth.outputs.access_token }}" | ||
|
||
- name: Login to GitHub Container Registry 📦 | ||
uses: docker/login-action@v3 | ||
|
@@ -70,8 +54,11 @@ jobs: | |
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Deploy 🚀 | ||
run: nix run .#publish-docker-image ${{ github.ref }} | ||
- name: Build and deploy Docker images to Google Container Registry 🚀 | ||
run: nix run .#publish-docker-image '${{ github.ref }}' '${{ matrix.connector }}' 'us-docker.pkg.dev/hasura-ddn/ddn/${{ matrix.connector }}' | ||
|
||
- name: Build and deploy Docker images to GitHub Packages 🚀 | ||
run: nix run .#publish-docker-image '${{ github.ref }}' '${{ matrix.connector }}' 'ghcr.io/hasura/${{ matrix.connector }}' | ||
|
||
# scream into Slack if something goes wrong | ||
- name: Report Status | ||
|
@@ -80,7 +67,7 @@ jobs: | |
with: | ||
status: ${{ job.status }} | ||
notify_when: failure | ||
notification_title: '😧 Error on <{repo_url}|{repo}>' | ||
message_format: '🐴 *{workflow}* {status_message} for <{repo_url}|{repo}>' | ||
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 }} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.