Skip to content

Draft Release

Draft Release #84

Workflow file for this run

# Copyright 2024 The Drasi Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Draft Release
on:
workflow_dispatch:
inputs:
tag:
description: 'Version Tag'
required: true
image_prefix:
description: 'Image Prefix'
required: false
default: 'ghcr.io/drasi-project'
permissions:
id-token: write # Required for requesting the JWT
contents: read # Required for actions/checkout
packages: read
env:
RELEASE_PATH: ./release
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Validate Branch
run: |
if [[ "${{ github.ref_name }}" =~ ^(release)/ ]]; then
echo "Branch has the correct prefix."
else
echo "Branch does not have the correct prefix. Exiting..."
exit 1
fi
build-query-container:
needs: validate
permissions:
packages: write
contents: read
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: [ubuntu-latest, ubuntu-24.04-arm]
component: [
{
label: 'Query Host',
path: 'query-container/query-host',
name: 'query-container-query-host'
},
{
label: 'Publish API',
path: 'query-container/publish-api',
name: 'query-container-publish-api'
},
{
label: 'View Service',
path: 'query-container/view-svc',
name: 'query-container-view-svc'
}
]
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
token: ${{ secrets.DRASI_CORE_PAT }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
with:
install: true
- name: Log in to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine platform
id: platform
run: |
if [[ "${{ matrix.runner }}" == "ubuntu-latest" ]]; then
echo "platform=linux/amd64" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.runner }}" == "ubuntu-24.04-arm" ]]; then
echo "platform=linux/arm64" >> $GITHUB_OUTPUT
fi
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: buildx-${{ matrix.component.name }}-${{ matrix.runner }}
restore-keys: |
buildx-${{ matrix.component.name }}-${{ matrix.runner }}
- name: Build and Push to GHCR
run: |
cd ${{ matrix.component.path }}
DOCKER_TAG_VERSION=${{ inputs.tag }} \
IMAGE_PREFIX=${{ inputs.image_prefix }} \
DOCKERX_OPTS="--push --platform ${{ steps.platform.outputs.platform }} --cache-to type=local,dest=/tmp/.buildx-cache,mode=max --cache-from type=local,src=/tmp/.buildx-cache" \
make
build-control-plane:
needs: validate
permissions:
packages: write
contents: read
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: [ubuntu-latest, ubuntu-24.04-arm]
component: [
{
label: 'Management API',
path: 'control-planes/mgmt_api',
name: 'api'
},
{
label: 'k8s Resource Provider',
path: 'control-planes/kubernetes_provider',
name: 'kubernetes-provider'
}
]
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
with:
install: true
- name: Log in to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine platform
id: platform
run: |
if [[ "${{ matrix.runner }}" == "ubuntu-latest" ]]; then
echo "platform=linux/amd64" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.runner }}" == "ubuntu-24.04-arm" ]]; then
echo "platform=linux/arm64" >> $GITHUB_OUTPUT
fi
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: buildx-${{ matrix.component.name }}-${{ matrix.runner }}
restore-keys: |
buildx-${{ matrix.component.name }}-${{ matrix.runner }}
- name: Build and Push to GHCR
run: |
cd ${{ matrix.component.path }}
DOCKER_TAG_VERSION=${{ inputs.tag }} \
IMAGE_PREFIX=${{ inputs.image_prefix }} \
DOCKERX_OPTS="--push --platform ${{ steps.platform.outputs.platform }} --cache-to type=local,dest=/tmp/.buildx-cache,mode=max --cache-from type=local,src=/tmp/.buildx-cache" \
make
build-sources:
needs: validate
permissions:
packages: write
contents: read
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: [ubuntu-latest, ubuntu-24.04-arm]
component: [
{
label: 'Change Router',
path: 'sources/shared/change-router',
name: 'source-change-router'
},
{
label: 'Change Dispatcher',
path: 'sources/shared/change-dispatcher',
name: 'source-change-dispatcher'
},
{
label: 'Query API',
path: 'sources/shared/query-api',
name: 'source-query-api'
},
{
label: 'Debezium Reactivator',
path: 'sources/relational/debezium-reactivator',
name: 'source-debezium-reactivator'
},
{
label: 'SQL Proxy',
path: 'sources/relational/sql-proxy',
name: 'source-sql-proxy'
},
{
label: 'CosmosDB Reactivator',
path: './sources/cosmosdb/cosmosdb-ffcf-reactivator',
name: 'source-cosmosdb-reactivator'
},
{
label: 'Gremlin Proxy',
path: 'sources/cosmosdb/gremlin-proxy',
name: 'source-gremlin-proxy'
},
{
label: 'Dataverse Reactivator',
path: './sources/dataverse/dataverse-reactivator',
name: 'source-dataverse-reactivator'
},
{
label: 'Dataverse Proxy',
path: './sources/dataverse/dataverse-proxy',
name: 'source-dataverse-proxy'
},
{
label: 'EventHub Reactivator',
path: './sources/eventhub/eventhub-reactivator',
name: 'source-eventhub-reactivator'
},
{
label: 'EventHub Proxy',
path: './sources/eventhub/eventhub-proxy',
name: 'source-eventhub-proxy'
},
{
label: 'Kubernetes Reactivator',
path: './sources/kubernetes/kubernetes-reactivator',
name: 'source-kubernetes-reactivator'
},
{
label: 'Kubernetes Proxy',
path: './sources/kubernetes/kubernetes-proxy',
name: 'source-kubernetes-proxy'
}
]
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
with:
install: true
- name: Log in to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine platform
id: platform
run: |
if [[ "${{ matrix.runner }}" == "ubuntu-latest" ]]; then
echo "platform=linux/amd64" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.runner }}" == "ubuntu-24.04-arm" ]]; then
echo "platform=linux/arm64" >> $GITHUB_OUTPUT
fi
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: buildx-${{ matrix.component.name }}-${{ matrix.runner }}
restore-keys: |
buildx-${{ matrix.component.name }}-${{ matrix.runner }}
- name: Build and Push to GHCR
run: |
cd ${{ matrix.component.path }}
DOCKER_TAG_VERSION=${{ inputs.tag }} \
IMAGE_PREFIX=${{ inputs.image_prefix }} \
DOCKERX_OPTS="--push --platform ${{ steps.platform.outputs.platform }} --cache-to type=local,dest=/tmp/.buildx-cache,mode=max --cache-from type=local,src=/tmp/.buildx-cache" \
make
build-reactions:
needs: validate
permissions:
packages: write
contents: read
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: [ubuntu-latest, ubuntu-24.04-arm]
component: [
{
label: 'SignalR',
path: 'reactions/signalr/signalr-reaction',
name: 'reaction-signalr',
platforms: 'linux/amd64,linux/arm64'
},
{
label: 'Dataverse',
path: './reactions/power-platform/dataverse/dataverse-reaction',
name: 'reaction-dataverse',
platforms: 'linux/amd64'
},
{
label: 'Debezium',
path: './reactions/debezium/debezium-reaction',
name: 'reaction-debezium',
platforms: 'linux/amd64,linux/arm64'
},
{
label: 'Debug',
path: './reactions/platform/debug-reaction',
name: 'reaction-debug',
platforms: 'linux/amd64,linux/arm64'
},
{
label: 'EventGrid',
path: './reactions/azure/eventgrid-reaction',
name: 'reaction-eventgrid',
platforms: 'linux/amd64,linux/arm64'
},
{
label: 'Gremlin',
path: './reactions/gremlin/gremlin-reaction',
name: 'reaction-gremlin',
platforms: 'linux/amd64,linux/arm64'
},
{
label: 'Result',
path: './reactions/platform/result-reaction',
name: 'reaction-result',
platforms: 'linux/amd64,linux/arm64'
},
{
label: 'StorageQueue',
path: './reactions/azure/storagequeue-reaction',
name: 'reaction-storagequeue',
platforms: 'linux/amd64,linux/arm64'
},
{
label: 'StoredProc',
path: './reactions/sql/storedproc-reaction',
name: 'reaction-storedproc',
platforms: 'linux/amd64,linux/arm64'
}
]
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
with:
install: true
- name: Log in to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine platform
id: platform
run: |
if [[ "${{ matrix.runner }}" == "ubuntu-latest" ]]; then
echo "platform=linux/amd64" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.runner }}" == "ubuntu-24.04-arm" ]]; then
echo "platform=linux/arm64" >> $GITHUB_OUTPUT
fi
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: buildx-${{ matrix.component.name }}-${{ matrix.runner }}
restore-keys: |
buildx-${{ matrix.component.name }}-${{ matrix.runner }}
- name: Build and Push to GHCR
if: contains(matrix.component.platforms, steps.platform.outputs.platform)
run: |
cd ${{ matrix.component.path }}
DOCKER_TAG_VERSION=${{ inputs.tag }} \
IMAGE_PREFIX=${{ inputs.image_prefix }} \
DOCKERX_OPTS="--push --platform ${{ steps.platform.outputs.platform }} --cache-to type=local,dest=/tmp/.buildx-cache,mode=max --cache-from type=local,src=/tmp/.buildx-cache" \
make
build-cli:
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: '1.21'
- name: Cache Go modules
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build
working-directory: cli
run: make VERSION='${{ inputs.tag }}'
- name: Upload artifact
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: cli
path: cli/bin
package-cli:
needs: build-cli
runs-on: ubuntu-latest
name: Publish ${{ matrix.os }}_${{ matrix.arch }} binaries
environment:
name: github-actions
strategy:
matrix:
include:
- os: linux
arch: arm64
- os: linux
arch: x64
- os: darwin
arch: arm64
- os: darwin
arch: x64
- os: windows
arch: x64
steps:
- name: Download binaries
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: cli
- name: Copy cli binaries to release (non-windows)
if: matrix.os != 'windows'
run: |
mkdir -p ${{ env.RELEASE_PATH}}/cli/${{ matrix.os }}-${{ matrix.arch }}/
cp -r ${{ matrix.os }}-${{ matrix.arch }}/drasi ${{ env.RELEASE_PATH}}/drasi-${{ matrix.os }}-${{ matrix.arch }}
- name: Copy cli binaries to release (windows)
if: matrix.os == 'windows'
run: |
mkdir -p ${{ env.RELEASE_PATH}}/cli/${{ matrix.os }}-${{ matrix.arch }}/
cp -r ${{ matrix.os }}-${{ matrix.arch }}/drasi.exe ${{ env.RELEASE_PATH}}/drasi-${{ matrix.os }}-${{ matrix.arch }}.exe
- name: Upload release
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: drasi_${{ matrix.os }}_${{ matrix.arch }}
path: ${{ env.RELEASE_PATH}}
vscode-extension:
name: Build and publish the VSCode extension
runs-on: ubuntu-latest
needs: validate
environment:
name: github-actions
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Building the extension
run: |
cd dev-tools/vscode/drasi
npm install -g @vscode/vsce
npm install
npm version ${{ inputs.tag }}
vsce package
- name: Copy the extension to release
run: |
mkdir -p ${{ env.RELEASE_PATH}}/vscode-extension/
cp dev-tools/vscode/drasi/drasi-*.vsix ${{ env.RELEASE_PATH}}
- name: Upload release
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: drasi_vscode_extension
path: ${{ env.RELEASE_PATH}}
release:
permissions:
contents: write
packages: read
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Draft Release
needs:
- validate
- build-query-container
- build-control-plane
- build-sources
- build-reactions
- package-cli
- vscode-extension
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Download CLI release
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: drasi_*
merge-multiple: true
path: ${{ env.RELEASE_PATH }}
- name: Download vscode release
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: drasi_vscode_extension
merge-multiple: true
path: ${{ env.RELEASE_PATH }}
- name: Draft Release
run: |
gh release create ${{ inputs.tag }} ${{ env.RELEASE_PATH }}/* --draft --title ${{ inputs.tag }} --target ${{ github.ref_name }} --generate-notes