Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inf 371 community release workflow #5595

Merged
merged 50 commits into from
May 20, 2024
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
9d2807f
feat(ci): Community releases
AliaksandrRyzhou May 15, 2024
8c92159
feat(ci): REGISTRY_OWNER change
AliaksandrRyzhou May 15, 2024
360a317
feat(ci): WF name has been changed
AliaksandrRyzhou May 16, 2024
9d9882e
feat(ci): Option to choose a service
AliaksandrRyzhou May 16, 2024
8657fd8
fix(ci): Fix condition
AliaksandrRyzhou May 16, 2024
90793a2
fix(ci): Embed service ahs been added
AliaksandrRyzhou May 16, 2024
d8b8d95
feat(ci): No environment
AliaksandrRyzhou May 16, 2024
2e98788
feat(ci): Getting a release version from Lerna
AliaksandrRyzhou May 16, 2024
2846582
feat(ci): Environment has been added
AliaksandrRyzhou May 16, 2024
6b54b35
feat(ci): Another way to get Lerna release version
AliaksandrRyzhou May 16, 2024
68e42bd
feat(ci): Echo LERNA_RELEASE_VERSION
AliaksandrRyzhou May 16, 2024
c1d5caa
feat(ci): Echo LERNA_RELEASE_VERSION
AliaksandrRyzhou May 16, 2024
cd16706
feat(ci): Output fix
AliaksandrRyzhou May 16, 2024
6e97669
feat(ci): GH_PACKAGES secret
AliaksandrRyzhou May 16, 2024
6ce9267
feat(ci): Matrix name instead of service name
AliaksandrRyzhou May 16, 2024
2de5821
feat(ci): Tag option and timeout update
AliaksandrRyzhou May 16, 2024
08cf095
feat(ci): Free space action has been added
AliaksandrRyzhou May 16, 2024
4bd75ee
feat(ci): EE for the community releases
AliaksandrRyzhou May 17, 2024
2863ec7
fix(ci): Service path fix
AliaksandrRyzhou May 17, 2024
af54b24
fix(ci): Service path fix
AliaksandrRyzhou May 17, 2024
ea657dc
fix(ci): Rename variable
AliaksandrRyzhou May 17, 2024
540fba2
fix(ci): Submodules fix
AliaksandrRyzhou May 17, 2024
9d1f545
fix(ci): Submodules fix
AliaksandrRyzhou May 17, 2024
5178c34
fix(ci): Submodules fix
AliaksandrRyzhou May 17, 2024
8afd846
fix(ci): Submodules condition
AliaksandrRyzhou May 17, 2024
fa8d01d
fix(ci): Branch has been deleted
AliaksandrRyzhou May 17, 2024
f64201c
fix(ci): Condition update
AliaksandrRyzhou May 17, 2024
ac4e2a0
fix(ci): Condition update
AliaksandrRyzhou May 17, 2024
f35e32c
fix(ci): Condition update
AliaksandrRyzhou May 17, 2024
6ea948d
Merge branch 'next' into inf-371-community-release-workflow
AliaksandrRyzhou May 17, 2024
e57cc1e
fix(ci): Pawel's recommendations
AliaksandrRyzhou May 17, 2024
a8b215f
fix(ci): Full matrix + latest tag for community releases
AliaksandrRyzhou May 17, 2024
115c0b8
Update .github/workflows/community-releases.yml
AliaksandrRyzhou May 18, 2024
5b3cc39
Update .github/workflows/community-releases.yml
AliaksandrRyzhou May 18, 2024
f19d2dd
Update .github/workflows/community-releases.yml
AliaksandrRyzhou May 18, 2024
5c7d86c
Update .github/workflows/community-releases.yml
AliaksandrRyzhou May 18, 2024
f1ecb37
Update .github/workflows/community-releases.yml
AliaksandrRyzhou May 18, 2024
d8e01f1
Update .github/workflows/community-releases.yml
AliaksandrRyzhou May 18, 2024
7a6155d
fix(ci): Variable renaming
AliaksandrRyzhou May 20, 2024
d37bf54
fix(ci): Syntax fix
AliaksandrRyzhou May 20, 2024
f1d7b12
fix(ci): Job renaming
AliaksandrRyzhou May 20, 2024
1269789
fix(ci): Environment + ws-ee and webhook-ee have been added in the ma…
AliaksandrRyzhou May 20, 2024
bad2f5f
fix(ci): Link submodules after pnpm install
AliaksandrRyzhou May 20, 2024
a399595
Merge branch 'next' into inf-371-community-release-workflow
AliaksandrRyzhou May 20, 2024
dfe68bd
fix(ci): PNPM version update
AliaksandrRyzhou May 20, 2024
bbd9408
Merge branch 'next' into inf-371-community-release-workflow
AliaksandrRyzhou May 20, 2024
eceb8c4
feat(ci): A new approach without tagging of a git repository during W…
AliaksandrRyzhou May 20, 2024
5a924c2
feat(ci): Output has been deleted
AliaksandrRyzhou May 20, 2024
8c15c6f
fix(ci): Fix of check
AliaksandrRyzhou May 20, 2024
70ccbd1
Merge branch 'next' into inf-371-community-release-workflow
AliaksandrRyzhou May 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 61 additions & 34 deletions .github/workflows/community-releases.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: Prepare Self-hosted Release

on:
workflow_dispatch:
inputs:
version:
description: 'The version to tag docker images'
required: true
type: string
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

permissions:
contents: write
Expand All @@ -17,27 +14,55 @@ permissions:
jobs:
prepare:
runs-on: ubuntu-latest
timeout-minutes: 80
timeout-minutes: 60
outputs:
latest-version: ${{ steps.get_version.outputs.latest-version }}
steps:
- uses: actions/checkout@v4
- name: Get Current Lerna Release version and comparing with the Git tag
id: get_version
shell: bash
run: |
LATEST_VERSION="v$(jq -r '.version' lerna.json)"
CURRENT_GIT_TAG="${{ github.ref_name }}"
if [ "$LATEST_VERSION" == "$CURRENT_GIT_TAG" ]
then
echo "latest-version=$(jq -r '.version' lerna.json)" >> $GITHUB_OUTPUT
else
echo "::error::The version in the file lerna.json does not match the git tag. The version in lerna.json is $LATEST_VERSION. The git version is $CURRENT_GIT_TAG"
exit 1
fi

docker_build:
build_docker:
runs-on: ubuntu-latest
needs: prepare
timeout-minutes: 80
timeout-minutes: 90
environment: Production
strategy:
fail-fast: false
matrix:
name: ['novu/api','novu/worker','novu/inbound-mail','novu/web','novu/webhook','novu/widget','novu/ws']
name: ['novu/api','novu/worker','novu/inbound-mail','novu/web','novu/webhook','novu/widget','novu/ws','novu/embed','novu/inbound-mail-ee','novu/worker-ee','novu/api-ee','novu/web-ee','novu/widget-ee','novu/embed-ee','novu/ws-ee','novu/webhook-ee']
steps:
- uses: actions/checkout@v4
- name: Git Checkout with Submodules
uses: actions/checkout@v4
if: contains(matrix.name, '-ee')
with:
submodules: true
token: ${{ secrets.SUBMODULES_TOKEN }}

- name: Git Checkout without Submodules
if: "!contains(matrix.name, '-ee')"
uses: actions/checkout@v4

- name: Variables
shell: bash
run: |
echo "The release version is ${{ needs.prepare.outputs.latest-version }}"
service=${{ matrix.name }}
echo "SERVICE_NAME=$(basename "${service//-/-}")" >> $GITHUB_ENV
SERVICE_NAME=$(basename "${service//-/-}")
SERVICE_COMMON_NAME=$(echo "$SERVICE_NAME" | sed 's/-ee$//')
echo "SERVICE_NAME=$SERVICE_NAME" >> $GITHUB_ENV
echo "SERVICE_COMMON_NAME=$SERVICE_COMMON_NAME" >> $GITHUB_ENV
echo "REGISTRY_OWNER=novuhq" >> $GITHUB_ENV

- name: Install pnpm
Expand All @@ -48,20 +73,32 @@ jobs:
with:
node-version: 20.8.1
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile
AliaksandrRyzhou marked this conversation as resolved.
Show resolved Hide resolved

- name: Link submodules
if: contains(matrix.name, '-ee')
run: pnpm symlink:submodules

- uses: ./.github/actions/free-space
- uses: ./.github/actions/setup-qemu

- name: Login To Registry
shell: bash
env:
GH_ACTOR: ${{ github.actor }}
GH_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
GH_PASSWORD: ${{ secrets.GH_PACKAGES }}
run: |
echo $GH_PASSWORD | docker login ghcr.io -u $GH_ACTOR --password-stdin

- name: Build Community Docker Image with Buildx, tag, and test
- name: Set Bull MQ Env variable for EE
if: contains(matrix.name, '-ee')
shell: bash
run: |
echo "BULL_MQ_PRO_NPM_TOKEN=${{ secrets.BULL_MQ_PRO_NPM_TOKEN }}" >> $GITHUB_ENV

- name: Build ${{ env.SERVICE_NAME }} Community Docker Image
shell: bash
env:
DOCKER_BUILD_ARGUMENTS: >
Expand All @@ -70,28 +107,18 @@ jobs:
--platform=linux/amd64,linux/arm64 --provenance=false
--output=type=image,name=ghcr.io/${{ env.REGISTRY_OWNER }}/${{ env.SERVICE_NAME }},push-by-digest=true,name-canonical=true
run: |
cd apps/$SERVICE_NAME && pnpm run docker:build
if [ "${{ env.SERVICE_NAME }}" = "embed" ] || [ "${{ env.SERVICE_NAME }}" = "embed-ee" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AliaksandrRyzhou can you please elaborate on this? Does embed differ between community and ee version? cc: @LetItRock

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure about it, I just decided so because we have a private package repo embed-ee. Maybe @LetItRock can clarify this moment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are currently a few services/apps without the enterprise functionality, so they are not different from the community build, and embed is one of these... however, the embed leaves in a different folder under the libs that's why we have this code... embed is a static JS script that is served with the http-server

cd libs/$SERVICE_COMMON_NAME
else
cd apps/$SERVICE_COMMON_NAME
fi
pnpm run docker:build
docker images

- name: Tag and Push docker image
shell: bash
run: |
docker tag novu-$SERVICE_NAME ghcr.io/$REGISTRY_OWNER/$SERVICE_NAME:${{ inputs.version }}
docker push ghcr.io/$REGISTRY_OWNER/$SERVICE_NAME:${{ inputs.version }}

tag_create:
runs-on: ubuntu-latest
needs: docker_build
timeout-minutes: 80
steps:
- uses: actions/checkout@v4
- name: Create tag ${{ inputs.version }}
uses: actions/github-script@v5
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ inputs.version }}',
sha: context.sha
})
docker tag novu-$SERVICE_COMMON_NAME ghcr.io/$REGISTRY_OWNER/${{ matrix.name }}:${{ needs.prepare.outputs.latest-version }}
docker tag novu-$SERVICE_COMMON_NAME ghcr.io/$REGISTRY_OWNER/${{ matrix.name }}:latest
docker push ghcr.io/$REGISTRY_OWNER/${{ matrix.name }}:${{ needs.prepare.outputs.latest-version }}
docker push ghcr.io/$REGISTRY_OWNER/${{ matrix.name }}:latest
Loading