Skip to content

Commit

Permalink
Add manifest generation and GH release
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-chambers committed Mar 14, 2024
1 parent e424baf commit 5462fa4
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 1 deletion.
38 changes: 37 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,21 @@ jobs:
run: nix run .#publish-docker-image ${{ github.ref }}

connector-definition:
# For now, only run on tagged releases because main builds generate a Docker image tag name that
# is not easily accessible here
# if: ${{ startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build connector definition
run: |
set -e pipefail
export DOCKER_IMAGE="ghcr.io/hasura/mongodb-connector:$GITHUB_REF_NAME"
export CLI_VERSION=$GITHUB_REF_NAME
make build
working-directory: ./connector-definition

- uses: actions/upload-artifact@v4
with:
name: connector-definition.tgz
Expand Down Expand Up @@ -170,4 +175,35 @@ jobs:
name: hasura-mongodb-${{ matrix.target }}${{ matrix.extension }}
path: release
if-no-files-found: error


release:
name: release to GitHub
needs:
# - docker
- connector-definition
- build-cli-binaries
runs-on: ubuntu-latest
# if: ${{ startsWith(github.ref, 'refs/tags/v') }}
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
path: release/artifacts
merge-multiple: true

- name: generate SHA-256 checksums
run: |
cd release/artifacts
sha256sum * > ./sha256sum
- name: generate CLI manifest
run: |
export VERSION="$GITHUB_REF_NAME"
./scripts/generate-manifest.sh
- name: create a draft release
uses: ncipollo/release-action@v1
with:
draft: true
artifacts: release/artifacts/*
15 changes: 15 additions & 0 deletions scripts/generate-manifest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -evo pipefail
ROOT="$(pwd)"

export LINUX_AMD64_SHA256=$(cat ${ROOT}/artifacts/release/*.sha256 | grep hasura-mongodb-x86_64-unknown-linux-gnu | cut -f1 -d' ')
export MACOS_AMD64_SHA256=$(cat ${ROOT}/artifacts/release/*.sha256 | grep hasura-mongodb-x86_64-apple-darwin | cut -f1 -d' ')
export WINDOWS_AMD64_SHA256=$(cat ${ROOT}/artifacts/release/*.sha256 | grep hasura-mongodb-x86_64-pc-windows-msvc.exe | cut -f1 -d' ')
export LINUX_ARM64_SHA256=$(cat ${ROOT}/artifacts/release/*.sha256 | grep hasura-mongodb-aarch64-unknown-linux-gnu | cut -f1 -d' ')
export MACOS_ARM64_SHA256=$(cat ${ROOT}/artifacts/release/*.sha256 | grep hasura-mongodb-aarch64-apple-darwin | cut -f1 -d' ')

(echo "cat <<EOF >${ROOT}/artifacts/release/manifest.yaml";
cat ${ROOT}/scripts/manifest.yaml; echo; echo EOF;
)>${ROOT}/artifacts/release/manifest-tmp.yaml
. ${ROOT}/artifacts/release/manifest-tmp.yaml
40 changes: 40 additions & 0 deletions scripts/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: ndc-mongo
version: "${VERSION}"
shortDescription: "CLI plugin for Hasura ndc-mongo"
homepage: https://hasura.io/connectors/mongo
platforms:
- selector: darwin-arm64
uri: "https://github.com/hasura/ndc-mongo/releases/download/${VERSION}/hasura-mongodb-aarch64-apple-darwin"
sha256: "${MACOS_ARM64_SHA256}"
bin: "hasura-ndc-mongo"
files:
- from: "./hasura-mongodb-aarch64-apple-darwin"
to: "hasura-ndc-mongo"
- selector: linux-arm64
uri: "https://github.com/hasura/ndc-mongo/releases/download/${VERSION}/hasura-mongodb-aarch64-unknown-linux-gnu"
sha256: "${LINUX_ARM64_SHA256}"
bin: "hasura-ndc-mongo"
files:
- from: "./hasura-mongodb-aarch64-unknown-linux-gnu"
to: "hasura-ndc-mongo"
- selector: darwin-amd64
uri: "https://github.com/hasura/ndc-mongo/releases/download/${VERSION}/hasura-mongodb-x86_64-apple-darwin"
sha256: "${MACOS_AMD64_SHA256}"
bin: "hasura-ndc-mongo"
files:
- from: "./hasura-mongodb-x86_64-apple-darwin"
to: "hasura-ndc-mongo"
- selector: windows-amd64
uri: "https://github.com/hasura/ndc-mongo/releases/download/${VERSION}/hasura-mongodb-x86_64-pc-windows-msvc.exe"
sha256: "${WINDOWS_AMD64_SHA256}"
bin: "hasura-ndc-mongo.exe"
files:
- from: "./hasura-mongodb-x86_64-pc-windows-msvc.exe"
to: "hasura-ndc-mongo.exe"
- selector: linux-amd64
uri: "https://github.com/hasura/ndc-mongo/releases/download/${VERSION}/hasura-mongodb-x86_64-unknown-linux-gnu"
sha256: "${LINUX_AMD64_SHA256}"
bin: "hasura-ndc-mongo"
files:
- from: "./hasura-mongodb-x86_64-unknown-linux-gnu"
to: "hasura-ndc-mongo"

0 comments on commit 5462fa4

Please sign in to comment.