-
-
Notifications
You must be signed in to change notification settings - Fork 184
141 lines (119 loc) · 4.3 KB
/
Copy pathbuild.yml
File metadata and controls
141 lines (119 loc) · 4.3 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
134
135
136
137
138
139
140
141
name: karrio-build
on:
push:
branches: ["main"]
workflow_dispatch:
jobs:
changes:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.changes.outputs.version }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
version:
- 'apps/api/karrio/server/VERSION'
python-packages:
# This job builds and releases all Python packages, including:
# - modules/
# - modules/connectors/
# - apps/api/
# - community/plugins/
# - plugins/
# Any subfolder with a pyproject.toml will be processed.
# See bin/build-and-release-packages for details.
needs: changes
if: ${{ needs.changes.outputs.version == 'true' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- name: Checkout submodules
run: |
# Only clone the community submodule which is public and needed for the build
git submodule update --init community
- 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
- id: get_tag
run: |
cat ./apps/api/karrio/server/VERSION
echo "tag=$(cat ./apps/api/karrio/server/VERSION)" >> "$GITHUB_ENV"
- name: Build Python packages
run: |
echo 'Building Python packages for version ${{ env.tag }}...'
./bin/build-and-release-packages --build-only --force
- name: Publish Python packages to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: .venv/dist/
skip-existing: true
password: ${{ secrets.PYPI_ACCESS_TOKEN || '' }}
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
steps:
- uses: actions/checkout@v4
- name: Checkout submodules
run: |
# Only clone the community submodule which is public and needed for the build
git submodule update --init community
- id: get_tag
run: |
cat ./apps/api/karrio/server/VERSION
echo "tag=$(cat ./apps/api/karrio/server/VERSION)" >> "$GITHUB_ENV"
- name: Build karrio server image
run: |
echo 'Building karrio server:${{ env.tag }}...'
ls -l ./modules/connectors 2>/dev/null || true
ls -l ./community/plugins 2>/dev/null || true
ls -l ./modules 2>/dev/null || true
./bin/build-server-image-from-source ${{ env.tag }}
- name: Push karrio server image
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
echo 'Pushing karrio server:${{ env.tag }}...'
docker push karrio/server:${{ env.tag }}
docker tag karrio/server:${{ env.tag }} karrio/server:latest-rc
docker push karrio/server:latest-rc
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
steps:
- uses: actions/checkout@v4
- id: get_tag
run: |
cat ./apps/api/karrio/server/VERSION
echo "tag=$(cat ./apps/api/karrio/server/VERSION)" >> "$GITHUB_ENV"
- name: Build karrio dashboard image
run: |
echo 'Building karrio dashboard:${{ env.tag }}...'
export NEXT_PUBLIC_DASHBOARD_VERSION=${{ env.tag }}
./bin/build-dashboard-image ${{ env.tag }}
- name: Push karrio dashboard image
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
echo 'Pushing karrio dashboard:${{ env.tag }}...'
docker push karrio/dashboard:${{ env.tag }}
docker tag karrio/dashboard:${{ env.tag }} karrio/dashboard:latest-rc
docker push karrio/dashboard:latest-rc