Skip to content

Commit

Permalink
feat(release): implement release with image build
Browse files Browse the repository at this point in the history
  • Loading branch information
ygrishajev committed Oct 7, 2024
1 parent 34dbbf1 commit 98f74c9
Show file tree
Hide file tree
Showing 50 changed files with 3,862 additions and 161 deletions.
3 changes: 2 additions & 1 deletion .commitlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"deployment",
"certificate",
"dx",
"stats"
"stats",
"release"
]
]
}
Expand Down
27 changes: 0 additions & 27 deletions .github/workflows/docker-build-deploy-web.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/docker-build-indexer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
- name: Build the Docker image
if: steps.filter.outputs.indexer == 'true'
run: npm run dc:build -- indexer
run: packages/docker/script/dc.sh build indexer
2 changes: 1 addition & 1 deletion .github/workflows/docker-build-provider-proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
- name: Build the Docker image
if: steps.filter.outputs.provider-proxy == 'true'
run: npm run dc:build -- provider-proxy
run: packages/docker/script/dc.sh build provider-proxy
2 changes: 1 addition & 1 deletion .github/workflows/docker-build-stats-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
- name: Build the Docker image
if: steps.filter.outputs.stats-web == 'true'
run: npm run dc:build -- stats-web
run: packages/docker/script/dc.sh build stats-web
54 changes: 54 additions & 0 deletions .github/workflows/release-all-apps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Release All Apps

on:
push:
branches: ["main"]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

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

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.14.0

- name: Restore root node_modules cache
uses: martijnhols/actions-cache@v3
id: cache
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build the Docker images
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "Akash Network Team"
npm run release -w apps/api -- --preRelease=beta --verbose --ci -r ${{ secrets.API_REGISTRY }}
npm run release -w apps/deploy-web -- --preRelease=beta -f --verbose --ci -r ${{ secrets.WEB_REGISTRY }}
82 changes: 82 additions & 0 deletions .github/workflows/release-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Release App

on:
workflow_dispatch:
inputs:
app:
type: choice
description: Which app to release
options:
- api
- deploy-web
required: true
release-type:
type: choice
description: Which app to release
options:
- prod
- beta
default: prod
force-build:
type: boolean
description: Rebuild the Docker image
default: false

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

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

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.14.0

- name: Restore root node_modules cache
uses: martijnhols/actions-cache@v3
id: cache
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build the Docker images
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "Akash Network Team"
pre_release=""
if [[ "${{ github.event.inputs.release-type }}" == 'beta' ]]; then
prerelease="--preRelease=beta"
fi
force_build=""
if [[ "${{ github.event.inputs.force-build }}" == 'true' ]]; then
force_build="-f"
fi
npm run release -w apps/${{ github.event.inputs.app }} -- $pre_release $force_build --verbose --ci -r ${{ secrets.API_REGISTRY }}
4 changes: 1 addition & 3 deletions .github/workflows/validate-n-build-api.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Validate and Build API

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

Expand Down Expand Up @@ -55,4 +53,4 @@ jobs:

- name: Build the Docker image for API
if: steps.filter.outputs.api == 'true'
run: npm run dc:build -- api
run: packages/docker/script/dc.sh build api
8 changes: 8 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if [[ "$CI" != "true" ]]; then
turbo update-apps-local-deps \
--filter=./packages/database \
--filter=./packages/env-loader \
--filter=./packages/http-sdk \
--filter=./packages/ui
git add ./apps/*/mvm.lock
fi
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- [Running the Application](#running-the-application)
- [How to run](#how-to-run)
- [Database Structure](#database-structure)
- [Release Workflow](./doc/release-workflow.md)

# Quick start

Expand Down
1 change: 1 addition & 0 deletions apps/api/.release-it.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@akashnetwork/releaser")
10 changes: 10 additions & 0 deletions apps/api/mvm.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"dependencies": {
"@akashnetwork/database": "1.0.0",
"@akashnetwork/env-loader": "1.0.1",
"@akashnetwork/http-sdk": "1.0.7"
},
"devDependencies": {
"@akashnetwork/dev-config": "1.0.0"
}
}
Empty file removed apps/api/package-lock.json
Empty file.
9 changes: 7 additions & 2 deletions apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "console-api",
"name": "@akashnetwork/console-api",
"version": "2.23.4",
"description": "Api providing data to the deploy tool",
"repository": {
Expand Down Expand Up @@ -28,7 +28,8 @@
"test:unit": "jest --selectProjects unit",
"test:unit:cov": "jest --selectProjects unit --coverage",
"test:unit:watch": "jest --selectProjects unit --watch",
"test:watch": "jest --selectProjects unit functional --watch"
"test:watch": "jest --selectProjects unit functional --watch",
"release": "release-it"
},
"dependencies": {
"@akashnetwork/akash-api": "^1.3.0",
Expand Down Expand Up @@ -96,7 +97,10 @@
},
"devDependencies": {
"@akashnetwork/dev-config": "*",
"@akashnetwork/docker": "*",
"@akashnetwork/releaser": "*",
"@faker-js/faker": "^8.4.1",
"@release-it/conventional-changelog": "github:ygrishajev/conventional-changelog#feature/pre-release",
"@types/http-assert": "^1.5.5",
"@types/http-errors": "^2.0.4",
"@types/jest": "^29.5.12",
Expand All @@ -120,6 +124,7 @@
"nodemon-webpack-plugin": "^4.8.2",
"prettier": "^3.3.0",
"prettier-plugin-tailwindcss": "^0.6.1",
"release-it": "^17.6.0",
"supertest": "^6.1.5",
"ts-jest": "^29.1.4",
"ts-loader": "^9.2.5",
Expand Down
1 change: 1 addition & 0 deletions apps/deploy-web/.release-it.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@akashnetwork/releaser")
10 changes: 10 additions & 0 deletions apps/deploy-web/mvm.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"dependencies": {
"@akashnetwork/env-loader": "1.0.1",
"@akashnetwork/http-sdk": "1.0.7",
"@akashnetwork/ui": "1.0.0"
},
"devDependencies": {
"@akashnetwork/dev-config": "1.0.0"
}
}
7 changes: 5 additions & 2 deletions apps/deploy-web/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "akash-console",
"name": "@akashnetwork/console-web",
"version": "2.16.2",
"private": true,
"description": "Web UI to deploy on the Akash Network and view statistic about network usage.",
Expand All @@ -12,7 +12,8 @@
"format": "prettier --write ./*.{ts,js,json} **/*.{ts,tsx,js,json}",
"lint": "eslint .",
"start": "next start",
"type-check": "tsc"
"type-check": "tsc",
"release": "release-it"
},
"dependencies": {
"@akashnetwork/akash-api": "^1.3.0",
Expand Down Expand Up @@ -114,6 +115,7 @@
"@keplr-wallet/types": "^0.12.111",
"@next/bundle-analyzer": "^14.0.1",
"@playwright/test": "^1.45.0",
"@release-it/conventional-changelog": "github:ygrishajev/conventional-changelog#feature/pre-release",
"@types/auth0": "^2.35.3",
"@types/file-saver": "^2.0.5",
"@types/js-yaml": "^4.0.5",
Expand All @@ -133,6 +135,7 @@
"postcss-nesting": "^12.0.2",
"prettier": "^3.3.0",
"prettier-plugin-tailwindcss": "^0.6.1",
"release-it": "^17.6.0",
"tailwindcss": "^3.4.3",
"typescript": "5.1.3"
},
Expand Down
9 changes: 9 additions & 0 deletions apps/indexer/mvm.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"dependencies": {
"@akashnetwork/database": "1.0.0",
"@akashnetwork/env-loader": "1.0.1"
},
"devDependencies": {
"@akashnetwork/dev-config": "1.0.0"
}
}
8 changes: 8 additions & 0 deletions apps/provider-console/mvm.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"dependencies": {
"@akashnetwork/ui": "1.0.0"
},
"devDependencies": {
"@akashnetwork/dev-config": "1.0.0"
}
}
5 changes: 5 additions & 0 deletions apps/provider-proxy/mvm.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"devDependencies": {
"@akashnetwork/dev-config": "1.0.0"
}
}
8 changes: 8 additions & 0 deletions apps/stats-web/mvm.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"dependencies": {
"@akashnetwork/ui": "1.0.0"
},
"devDependencies": {
"@akashnetwork/dev-config": "1.0.0"
}
}
Loading

0 comments on commit 98f74c9

Please sign in to comment.