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 363a9e2
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 1 deletion.
59 changes: 58 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,56 @@ 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
cat ./sha256sum
- name: generate CLI manifest
run: |
export VERSION="$GITHUB_REF_NAME"
./scripts/generate-manifest.sh
- uses: actions/upload-artifact@v4
with:
name: manifest.yaml
path: release/manifest.yaml
if-no-files-found: error

- name: Get version from tag
id: get-version
run: |
echo "tagged_version=0.1.0" >> $GITHUB_OUTPUT
shell: bash

- uses: mindsers/changelog-reader-action@v2
id: changelog-reader
with:
version: ${{ steps.get-version.outputs.tagged_version }}
path: ./CHANGELOG.md

- name: create a draft release
uses: ncipollo/release-action@v1
with:
draft: true
tag: v${{ steps.get-version.outputs.tagged_version }}
body: ${{ steps.changelog-reader.outputs.changes }}
artifacts: release/artifacts/*
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# MongoDB Connector Changelog
This changelog documents the changes between release versions.

## [Unreleased]
Changes to be included in the next upcoming release

- Improved error messages when unsupported enum types or unions of literal types are found, and allow these types to be used in relaxed types mode ([#17](https://github.com/hasura/ndc-nodejs-lambda/pull/17))

## [0.1.0] - 2024-03-14
TBD
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}/release/artifacts/sha256sum | grep hasura-mongodb-x86_64-unknown-linux-gnu | cut -f1 -d' ')
export MACOS_AMD64_SHA256=$(cat ${ROOT}/release/artifacts/sha256sum | grep hasura-mongodb-x86_64-apple-darwin | cut -f1 -d' ')
export WINDOWS_AMD64_SHA256=$(cat ${ROOT}/release/artifacts/sha256sum | grep hasura-mongodb-x86_64-pc-windows-msvc.exe | cut -f1 -d' ')
export LINUX_ARM64_SHA256=$(cat ${ROOT}/release/artifacts/sha256sum | grep hasura-mongodb-aarch64-unknown-linux-gnu | cut -f1 -d' ')
export MACOS_ARM64_SHA256=$(cat ${ROOT}/release/artifacts/sha256sum | grep hasura-mongodb-aarch64-apple-darwin | cut -f1 -d' ')

(echo "cat <<EOF >${ROOT}/release/manifest.yaml";
cat ${ROOT}/scripts/manifest.yaml; echo; echo EOF;
)>${ROOT}/release/manifest-tmp.yaml
. ${ROOT}/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 363a9e2

Please sign in to comment.