-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (60 loc) · 2.13 KB
/
release.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
name: release
on:
push:
branches:
- 'main'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Display build number
run: |
echo "Build number: ${{ github.run_number }}"
- name: Increment patch version
id: increment_patch_version
run: |
git fetch --tags
latestTag=$(git describe --tags `git rev-list --tags --max-count=1`)
if [[ $latestTag == pre_v* ]]; then
newTag="${latestTag#pre_v}"
else
IFS='.' read -ra parts <<< "${latestTag//v/}"
major=${parts[0]}
minor=${parts[1]}
patch=${parts[2]}
patch=$((patch+1))
newTag="$major.$minor.$patch"
fi
echo "newTag=$newTag" >> $GITHUB_ENV
- name: Create patch tag
id: create_patch_tag
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git tag -a v${{ env.newTag }} -m "Release v${{ env.newTag }}"
git push origin v${{ env.newTag }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker backend image
uses: docker/build-push-action@v5
with:
context: .
file: ./backend/Dockerfile
push: true
tags: retypeme/retypeme-backend:${{ env.newTag }}, retypeme/retypeme-backend:latest
build-args: |
REPOSITORY_TOKEN=${{ secrets.REPOSITORY_TOKEN }}
- name: Build and push Docker frontend image
uses: docker/build-push-action@v5
with:
context: ./frontend
file: ./frontend/Dockerfile
push: true
tags: retypeme/retypeme-frontend:${{ env.newTag }}, retypeme/retypeme-frontend:latest
build-args: |
NEXT_PUBLIC_ENV_LOCAL_INFURA_AMOY_API_KEY=${{ secrets.NEXT_PUBLIC_ENV_LOCAL_INFURA_AMOY_API_KEY }}