Skip to content

Commit

Permalink
build: setup ci/cd pipeline
Browse files Browse the repository at this point in the history
build: fix ci/cd canary action

fix: missing type

Add build args to canary workflow

build(gh-actions): update gh action template versions to latest

build(cd): argo cd should target git tags

build: drop canary channels, use v0.*.*

build(ci): handle no semver tags case

Reset version # back to 0

Add release-it

Progress

Test

Test

Test

Fixes

v0.1.1

Reset version number, use minor release by default

Test

Test

Drop github from CI

Test

Progress

Test

Cleanup

Add more scripts

Updates

Progress

Git pull before anything

chore: use auto-changelog

Use conventional commits

Infer next version

PR

Create PR

Do not create new branch
  • Loading branch information
BazzaDEV committed Nov 2, 2024
1 parent 4ea3b75 commit 96308e5
Show file tree
Hide file tree
Showing 20 changed files with 2,265 additions and 59 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Release
on:
workflow_dispatch:
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
pull-requests: write
id-token: write

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Login to git
run: |
git pull
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Install Node.js 20
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
architecture: 'x64'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Determine next version
id: next-version
run: |
NEW_VERSION=$(pnpm release --ci --release-version | tail -n1)
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
#
# - name: Setup Docker Buildx
# uses: docker/setup-buildx-action@v3
#
# - name: Login to ghcr.io
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Build @avelin/app
# uses: docker/build-push-action@v6
# with:
# context: .
# file: ./apps/web/Dockerfile
# push: true
# tags: ghcr.io/avelinapp/web:latest,ghcr.io/avelinapp/web:${{ steps.next_version.outputs.new_version }},ghcr.io/avelinapp/web:v${{ steps.next_version.outputs.new_version }}
# build-args: NEXT_PUBLIC_APP_URL=https://avelin.app,NEXT_PUBLIC_API_URL=https://api.avelin.app,NEXT_PUBLIC_SYNC_URL=wss://sync.avelin.app
# platforms: linux/amd64
#
# - name: Build @avelin/api
# uses: docker/build-push-action@v6
# with:
# context: .
# file: ./apps/api/Dockerfile
# push: true
# tags: ghcr.io/avelinapp/api:latest,ghcr.io/avelinapp/api:${{ steps.next_version.outputs.new_version }},ghcr.io/avelinapp/api:v${{ steps.next_version.outputs.new_version }}
# platforms: linux/amd64
#
# - name: Build @avelin/sync
# uses: docker/build-push-action@v6
# with:
# context: .
# file: ./apps/sync/Dockerfile
# push: true
# tags: ghcr.io/avelinapp/sync:latest,ghcr.io/avelinapp/sync:${{ steps.next_version.outputs.new_version }},ghcr.io/avelinapp/sync:v${{ steps.next_version.outputs.new_version }}
# platforms: linux/amd64

- name: Bump version
run: |
pnpm release --ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create release PR
uses: peter-evans/create-pull-request@v7
with:
title: 'v${{ steps.next_version.outputs.new_version }}'
assignees: 'bazzadev'
38 changes: 38 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"$schema": "https://unpkg.com/release-it/schema/release-it.json",
"plugins": {
"@release-it/conventional-changelog": {
"infile": "CHANGELOG.md",
"preset": {
"name": "conventionalcommits",
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Fixes"
},
{}
]
}
}
},
"git": {
"commitMessage": "v${version}",
"tagName": "v${version}",
"push": false,
"commit": false,
"requireCleanWorkingDir": false,
"changelog": "pnpm dlx auto-changelog --stdout --commit-limit false --unreleased --template https://raw.githubusercontent.com/release-it/release-it/main/templates/changelog-compact.hbs"
},
"github": {
"release": true,
"releaseName": "v${version}",
"draft": true
},
"hooks": {
"after:bump": "node scripts/sync-versions.js && pnpm dlx auto-changelog -p"
}
}
1 change: 0 additions & 1 deletion apps/web/components/editor/editor-toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ const UserAvatar = ({
className={cn(
'h-6 w-6 text-[11px] font-medium drop-shadow-sm border-[0.5px] border-white',
colors[user.color as BaseColor].avatar_bg,
colors[user.color as BaseColor].avatar_placeholder_text,
className,
)}
>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/lib/api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createClient } from '@avelin/api/client'

if (!process.env.NEXT_PUBLIC_API_URL) {
throw new Error('API_URL is not set')
throw new Error('NEXT_PUBLIC_API_URL is not set')
}

export const api = createClient(process.env.NEXT_PUBLIC_API_URL)
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@avelin/web",
"version": "0.1.0",
"version": "0.1.1",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
20 changes: 20 additions & 0 deletions deploy/argo/avelin-application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: avelin
namespace: argocd
spec:
project: default
source:
repoURL: 'https://github.com/avelinapp/avelin.git'
targetRevision: '>=v0.0.0'
path: 'deploy/k8s'
destination:
server: 'https://kubernetes.default.svc'
namespace: avelin
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
1 change: 1 addition & 0 deletions deploy/k8s/api-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ spec:
containers:
- name: avelin-api
image: ghcr.io/avelinapp/api:latest
imagePullPolicy: Always
ports:
- containerPort: 4000
protocol: TCP
Expand Down
1 change: 1 addition & 0 deletions deploy/k8s/sync-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ spec:
containers:
- name: avelin-sync
image: ghcr.io/avelinapp/sync:latest
imagePullPolicy: Always
ports:
- containerPort: 4100
protocol: TCP
Expand Down
1 change: 1 addition & 0 deletions deploy/k8s/web-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ spec:
containers:
- name: avelin-web
image: ghcr.io/avelinapp/web:latest
imagePullPolicy: Always
ports:
- containerPort: 3000
protocol: TCP
Expand Down
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "avelin",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "turbo build",
Expand All @@ -8,10 +9,17 @@
"lint": "turbo lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"db:push": "turbo run db:push",
"ui:add": "turbo run ui:add"
"ui:add": "turbo run ui:add",
"release": "release-it",
"release:patch": "release-it patch",
"release:minor": "release-it minor",
"release:major": "release-it major"
},
"devDependencies": {
"@release-it/conventional-changelog": "^9.0.2",
"auto-changelog": "^2.5.0",
"prettier": "catalog:",
"release-it": "^17.10.0",
"turbo": "catalog:",
"typescript": "catalog:"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@avelin/auth",
"version": "0.0.0",
"version": "0.1.1",
"private": true,
"scripts": {
"dev": "tsc --watch",
Expand Down
2 changes: 1 addition & 1 deletion packages/database/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@avelin/database",
"version": "0.0.0",
"version": "0.1.1",
"private": true,
"license": "MIT",
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@avelin/eslint-config",
"version": "0.0.0",
"version": "0.1.1",
"private": true,
"files": [
"index.js"
Expand Down
2 changes: 1 addition & 1 deletion packages/icons/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@avelin/icons",
"version": "0.0.0",
"version": "0.1.1",
"private": true,
"scripts": {
"dev": "tsc --watch",
Expand Down
2 changes: 1 addition & 1 deletion packages/id/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@avelin/id",
"version": "0.0.0",
"version": "0.1.1",
"type": "module",
"private": true,
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/prettier-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@avelin/prettier-config",
"version": "0.0.0",
"version": "0.1.1",
"private": true,
"license": "MIT",
"main": "./index.mjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@avelin/typescript-config",
"version": "0.0.0",
"version": "0.1.1",
"private": true,
"license": "MIT",
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@avelin/ui",
"version": "0.0.0",
"version": "0.1.1",
"private": true,
"scripts": {
"ui:init": "pnpm dlx shadcn@latest init",
Expand Down
Loading

0 comments on commit 96308e5

Please sign in to comment.