-
-
Notifications
You must be signed in to change notification settings - Fork 183
133 lines (115 loc) · 4.14 KB
/
Copy pathinsiders-build.yml
File metadata and controls
133 lines (115 loc) · 4.14 KB
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: insiders-build
on:
push:
branches: ["main"]
workflow_dispatch:
jobs:
changes:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.changes.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
version:
- 'apps/api/karrio/server/VERSION'
insiders-wheels:
needs: changes
if: ${{ needs.changes.outputs.version == 'true' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
actions: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GH_PAT }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine setuptools wheel
- id: get_tag
run: |
cat ./apps/api/karrio/server/VERSION
echo "tag=$(cat ./apps/api/karrio/server/VERSION)" >> "$GITHUB_ENV"
- name: Create or get GitHub release
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
run: |
echo 'Checking for existing GitHub release v${{ env.tag }} in karrio-insiders repository...'
if gh release view "v${{ env.tag }}" --repo karrioapi/karrio-insiders >/dev/null 2>&1; then
echo 'Release v${{ env.tag }} already exists in karrio-insiders, using existing release'
else
echo 'Creating new GitHub release v${{ env.tag }} in karrio-insiders repository...'
gh release create "v${{ env.tag }}" \
--repo karrioapi/karrio-insiders \
--title "Karrio Insiders v${{ env.tag }}" \
--notes "Karrio Insiders wheels release v${{ env.tag }}" \
--draft
fi
- name: Build and publish insiders wheels
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
run: |
echo 'Building and publishing insiders wheels for version ${{ env.tag }}...'
./bin/publish-insiders-wheels ${{ env.tag }}
insiders-server-build:
needs: changes
if: ${{ needs.changes.outputs.version == 'true' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
env:
DOCKER_BUILDKIT: 1
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GH_PAT }}
- id: get_tag
run: |
cat ./apps/api/karrio/server/VERSION
echo "tag=$(cat ./apps/api/karrio/server/VERSION)" >> "$GITHUB_ENV"
- name: Build insider server image
run: |
echo 'Build and push karrio-insiders server:${{ env.tag }}...'
echo ${{ secrets.GH_PAT }} | docker login ghcr.io -u USERNAME --password-stdin
./bin/build-insiders-image ${{ env.tag }} &&
docker push ghcr.io/karrioapi/server:${{ env.tag }} || exit 1
insiders-dashboard-build:
needs: changes
if: ${{ needs.changes.outputs.version == 'true' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
env:
DOCKER_BUILDKIT: 1
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GH_PAT }}
- id: get_tag
run: |
cat ./apps/api/karrio/server/VERSION
echo "tag=$(cat ./apps/api/karrio/server/VERSION)" >> "$GITHUB_ENV"
- name: Build insider dashboard image
run: |
echo 'Build and push karrio-insiders dashboard:${{ env.tag }}...'
echo ${{ secrets.GH_PAT }} | docker login ghcr.io -u USERNAME --password-stdin
KARRIO_IMAGE=ghcr.io/karrioapi/dashboard SOURCE=https://github.com/karrioapi/karrio-insiders ./bin/build-dashboard-image ${{ env.tag }} &&
docker push ghcr.io/karrioapi/dashboard:${{ env.tag }} || exit 1