-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (116 loc) · 3.97 KB
/
release.yaml
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
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 }}
# This should already be installed!
# - name: Install yq
# run: |
# wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq
# chmod +x /usr/bin/yq
- name: Update K8s manifests
run: |
VERSION=v${{ steps.next_version.outputs.new_version }}
apps=("web" "api" "sync")
manifests_dir="deploy/k8s"
for app in "${apps[@]}"; do
manifest="$manifests_dir/${app}-deploy.yaml"
if [ -f "$manifest" ]; then
echo "Updating image tag in $manifest to $VERSION"
yq e -i ".spec.template.spec.containers[].image = \"ghcr.io/avelinapp/$app:$VERSION\"" "$manifest"
else
echo "Manifest file $manifest not found!"
exit 1
fi
done
- name: Create release PR
uses: peter-evans/create-pull-request@v7
with:
title: 'v${{ steps.next_version.outputs.new_version }}'
assignees: 'bazzadev'