forked from akash-network/console
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (67 loc) · 2.52 KB
/
release-all-apps.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Release All Apps
on:
push:
branches: ["main"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
release:
name: Release
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: Get the latest tag
id: latest_tag
run: |
output="value=$(git describe --tags --abbrev=0)"
echo $output
echo $output >> $GITHUB_OUTPUT
- name: Generate releases and build docker images
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "CI"
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 }}
- name: Trigger deployments
run: |
latest_tag=${{ steps.latest_tag.outputs.value }}
api_tags=$(git tag --sort=-creatordate --merged | grep '^console-api/v')
new_api_tag=$(echo "$api_tags" | awk -v latest="$latest_tag" '$0 > latest' | head -n 1)
if [ -z "$new_api_tag" ]; then
echo "No new console-api tag found. Skipping api deployment."
else
echo "Dispatching deploy workflow for: $new_api_tag"
curl -X POST \
-H "Authorization: token ${{ secrets.AKASH_GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/actions/workflows/deploy-api-to-akash.yml/dispatches \
-d "{\"ref\": \"main\", \"inputs\": { \"tag\": \"$new_api_tag\" }}"
fi