forked from WDaan/hoppscotch-helm
-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (90 loc) · 3.35 KB
/
update.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Update Release
on:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
packages: write
jobs:
build-and-push-containers:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: hoppscotch/hoppscotch
ref: main
- name: Fetch Latest Release Tag
id: fetch_tag
env:
GH_TOKEN: ${{ github.token }}
run: |
tag=$(gh release view -R hoppscotch/hoppscotch --json tagName | jq -r .tagName)
echo "tag=${tag}" >> $GITHUB_OUTPUT
# This should not be needed
- name: copy .env
run: cp .env.example .env
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish Docker image (Backend)
uses: docker/build-push-action@v5
with:
file: packages/hoppscotch-backend/Dockerfile
context: .
target: prod
push: true
tags: ghcr.io/wdaan/hoppscotch-backend:${{ steps.fetch_tag.outputs.tag }}
- name: Build and publish Docker image (web)
uses: docker/build-push-action@v5
with:
file: packages/hoppscotch-selfhost-web/Dockerfile
context: .
push: true
tags: ghcr.io/wdaan/hoppscotch-web:${{ steps.fetch_tag.outputs.tag }}
- name: Build and publish Docker image (Admin)
uses: docker/build-push-action@v5
with:
file: packages/hoppscotch-sh-admin/Dockerfile
context: .
push: true
tags: ghcr.io/wdaan/hoppscotch-admin:${{ steps.fetch_tag.outputs.tag }}
update-chart-versions:
runs-on: ubuntu-latest
needs: [build-and-push-containers]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch Latest Release Tag
id: fetch_tag
env:
GH_TOKEN: ${{ github.token }}
run: |
tag=$(gh release view -R hoppscotch/hoppscotch --json tagName | jq -r .tagName)
echo "tag=${tag}" >> $GITHUB_OUTPUT
- name: Update Chart Versions
id: update_chart
run: |
tag="${{ steps.fetch_tag.outputs.tag }}"
# set current app version
yq e ".appVersion = \"${tag}\"" -i charts/hoppscotch/Chart.yaml
# bump current chart MINOR version
yq e '.version' charts/hoppscotch/Chart.yaml | awk -F. '{ print $1,$2+1,$3 }' OFS=. | xargs -I{} yq e '.version = "{}"' -i charts/hoppscotch/Chart.yaml
- name: Open PR
env:
GIT_AUTHOR_NAME: hoppscotch-bot
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: hoppscotch-bot
GIT_COMMITTER_EMAIL: [email protected]
GH_TOKEN: ${{ github.token }}
run: |
tag="${{ steps.fetch_tag.outputs.tag }}"
git checkout -b "update/${tag}"
git add charts/hoppscotch/Chart.yaml
git commit -m "feat: update hoppscotch version to release ${tag}"
git push origin "update/${tag}"
gh pr create --title "feat: update hoppscotch version to release ${tag}" \
--body "Updating chart to hoppscotch release [${tag}](https://github.com/hoppscotch-io/hoppscotch/releases/tag/${tag})."