-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(release): implement release with image build
- Loading branch information
1 parent
c0d50b1
commit a9fa7e8
Showing
50 changed files
with
3,869 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,8 @@ | |
"certificate", | ||
"dx", | ||
"config", | ||
"stats" | ||
"stats", | ||
"release" | ||
] | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ${{ vars.API_REGISTRY }} | ||
npm run release -w apps/deploy-web -- --preRelease=beta -f --verbose --ci -r ${{ vars.WEB_REGISTRY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
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 | ||
repo="${{ github.event.inputs.app == 'api' && vars.API_REGISTRY || vars.WEB_REGISTRY }}" | ||
npm run release -w apps/${{ github.event.inputs.app }} -- $pre_release $force_build --verbose --ci -r $repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require("@akashnetwork/releaser") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require("@akashnetwork/releaser") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"devDependencies": { | ||
"@akashnetwork/dev-config": "1.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Release Workflow Documentation | ||
|
||
## Overview | ||
|
||
This release workflow leverages **release-it**, **Docker**, **Docker Compose**, **GitHub Actions**, and a set of custom CLI bash scripts to manage the release process. The workflow adheres to **Semantic Versioning (SemVer)** and supports both beta pre-releases and final releases. | ||
|
||
## Release Flow | ||
|
||
The release process is divided into two key stages: pre-release (beta) and final release. This is done using SemVer conventions. | ||
|
||
### 1. Pre-Release (Beta) | ||
|
||
To create a **pre-release** (beta) version, the following command is used. This will create a beta version using the `release-it` tool with the specified options: | ||
|
||
```bash | ||
npm run release -w apps/$APP -- --preRelease=beta --verbose --ci -r $REGISTRY | ||
``` | ||
|
||
#### Key Options: | ||
- `--preRelease`: Marks the release as a beta pre-release. | ||
- `--verbose`: Provides detailed output for troubleshooting. | ||
- `--ci`: Ensures the release runs in a continuous integration environment. | ||
- `-r`: Registry to push the Docker image. | ||
|
||
### 2. Final Release | ||
|
||
For creating a final release, the command below is used. This will bump the version based on SemVer and push the release. | ||
|
||
```bash | ||
npm run release -w apps/$APP -- --verbose --ci -r $REGISTRY | ||
``` | ||
|
||
This should be run manually after validating the beta pre-release. Manual workflow is available in the GitHub Actions interface. | ||
|
||
## GitHub Actions Workflow | ||
|
||
### Pre-Release on Merge | ||
|
||
When a merge occurs on the `main` branch, a **beta** version is automatically created using GitHub Actions. The workflow is triggered by the merge event, ensuring that each change is reflected in a pre-release. | ||
|
||
### Manual Release | ||
|
||
Final releases are not triggered automatically. Instead, they are initiated manually via the GitHub Actions interface. This allows for flexibility in verifying and ensuring that the beta version is stable before creating an official release. | ||
|
||
## Customs scripts | ||
Scripts that are used in the release process are located in the `docker` package. These scripts are used to build Docker images, deploy services, and manage the release process. Check out the [README.md](../packages/docker/README.md) for more details. | ||
`release-it` config is also shared via local packages. | ||
|
||
## Roadmap | ||
- add alpha pre-release once development is provisioned | ||
- implement actual deployment to infra as currently only the Docker image is build and pushed |
Oops, something went wrong.