Skip to content

Fix/event constraint append many #1433

Fix/event constraint append many

Fix/event constraint append many #1433

Workflow file for this run

name: PR Prerelase
env:
NUGET_OUTPUT: ./Artifacts/NuGet
NUGET_SOURCE: https://nuget.pkg.github.com/cratis/index.json
DOTNET8_VERSION: "8.0.405"
DOTNET_VERSION: "9.0.x"
KERNEL_CACHE: "kernel-cache-${{ github.sha }}"
WORKBENCH_CACHE: "web-cache-${{ github.sha }}"
on:
pull_request:
types: [opened, edited, synchronize, reopened]
branches:
- "**"
paths:
- "Source/**"
- ".github/workflows/**"
jobs:
release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.release.outputs.version }}
publish: ${{ steps.release.outputs.should-publish }}
prerelease: ${{ steps.release.outputs.prerelease }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Release
id: release
uses: cratis/release-action@v1
kernel:
if: needs.release.outputs.publish == 'true'
runs-on: ubuntu-latest
needs: [release]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .Net
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
${{ env.DOTNET8_VERSION }}
${{ env.DOTNET_VERSION }}
- uses: actions/cache@v3
id: kernel-output
with:
path: ./Source/Kernel/Server/out
key: ${{ env.KERNEL_CACHE }}
- name: Build
working-directory: ./Source/Kernel/Server
run: |
dotnet publish -c Debug -o out/x64
cp -r out/x64 out/arm64
workbench:
if: needs.release.outputs.publish == 'true'
runs-on: ubuntu-latest
needs: [release]
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/cache@v3
id: workbench-output
with:
path: ./Source/Workbench/Web/wwwroot
key: ${{ env.WORKBENCH_CACHE }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: "https://registry.npmjs.org"
- uses: actions/cache@v3
id: yarn-cache
with:
path: |
**/node_modules
**/.eslintcache
**/yarn.lock
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Yarn install
working-directory: ./Source/Workbench/Web
run: yarn
- name: Build JS/TS
working-directory: ./Source/Workbench/Web
run: |
export NODE_OPTIONS="--max-old-space-size=4096"
yarn build
publish-nuget-packages:
if: needs.release.outputs.publish == 'true'
runs-on: ubuntu-latest
needs: [release]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .Net
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
${{ env.DOTNET8_VERSION }}
${{ env.DOTNET_VERSION }}
- name: Remove any existing artifacts
run: rm -rf ${{ env.NUGET_OUTPUT }}
- name: Build
run: dotnet build --configuration Debug
- name: Add GitHub Package Registry to NuGet
run: dotnet nuget add source --name github --username cratis --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text ${{ env.NUGET_SOURCE }}
- name: Create NuGet packages
run: dotnet pack --no-build --configuration Debug -o ${{ env.NUGET_OUTPUT }} -p:PackageVersion=${{ needs.release.outputs.version }}
- name: Push NuGet packages
run: dotnet nuget push '${{ env.NUGET_OUTPUT }}/*.nupkg' --skip-duplicate --timeout 900 --api-key ${{ secrets.GITHUB_TOKEN }} --source "github"
- name: Add comment for NuGet packages
uses: mshick/add-pr-comment@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: |
NuGet packages for this PR, e.g. Cratis:
https://github.com/cratis/chronicle/packages/1655206?version=${{ needs.release.outputs.version }}
allow-repeats: false
publish-docker:
if: needs.release.outputs.publish == 'true'
runs-on: ubuntu-latest
needs: [workbench, kernel, release]
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/cache@v3
id: kernel-output
with:
path: ./Source/Kernel/Server/out
key: ${{ env.KERNEL_CACHE }}
- uses: actions/cache@v3
id: workbench-output
with:
path: ./Source/Workbench/Web/wwwroot
key: ${{ env.WORKBENCH_CACHE }}
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to GitHub Docker Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Development Docker Image
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Docker/Development/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/cratis/chronicle:${{ needs.release.outputs.version }}
build-args: |
VERSION=${{ needs.release.outputs.version }}
ENTRYPOINT=pr_entrypoint.sh
- name: Add comment for Docker image
uses: mshick/add-pr-comment@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: |
Docker Image for this PR:
https://ghcr.io/cratis/chronicle:${{ needs.release.outputs.version }}
docker run ghcr.io/cratis/chronicle:${{ needs.release.outputs.version }}
allow-repeats: false