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

WIP feat(release): implement release with image build #389

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
"billing",
"provider",
"deployment",
"certificate",
"dx"
"dx",
"release",
"certificate"
]
]
}
Expand Down
27 changes: 0 additions & 27 deletions .github/workflows/docker-build-deploy-web.yml

This file was deleted.

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:
- stable
- beta
default: stable
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 }}
2 changes: 0 additions & 2 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
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if [[ "$CI" != "true" ]]; then
npm run update-apps-local-deps
git add --all
fi
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,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")
Loading