Skip to content

Commit 530e86d

Browse files
committed
ci: update
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
1 parent 98bd6f6 commit 530e86d

File tree

3 files changed

+51
-28
lines changed

3 files changed

+51
-28
lines changed

.github/workflows/rolling.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,32 @@ jobs:
2929
with:
3030
fetch-depth: 0
3131
token: ${{ steps.app-token.outputs.token }}
32+
path: client-python
3233
- name: Install python and dependencies
3334
run: |
3435
pipx install poetry || true
3536
- name: Setup Python
3637
uses: actions/setup-python@v5
3738
with:
38-
python-version-file: pyproject.toml
39+
python-version-file: client-python/pyproject.toml
40+
- name: Fetch schema
41+
uses: actions/checkout@v5
42+
with:
43+
repository: goauthentik/authentik
44+
token: "${{ steps.app-token.outputs.token }}"
45+
ref: main
46+
path: authentik
47+
sparse-checkout: |
48+
schema.yml
49+
sparse-checkout-cone-mode: false
3950
- name: Publish to GitHub
51+
working-directory: client-python
4052
env:
4153
GH_TOKEN: ${{ steps.app-token.outputs.token }}
4254
run: |
43-
wget -O schema.yml "https://raw.githubusercontent.com/goauthentik/authentik/main/schema.yml"
4455
version="$(yq -r '.info.version' schema.yml)-$(date +%s)"
45-
git restore schema.yml
46-
47-
make ref=main version="$version"
48-
git diff --exit-code >/dev/null && exit 0 || echo
56+
make version="$version"
57+
[ "$(wc -l < diff.test)" -lt 4 ] && exit 0 || echo
4958
5059
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
5160
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
@@ -58,9 +67,10 @@ jobs:
5867
truncate -s '<125000' diff.test
5968
gh release create v$version -F diff.test --prerelease
6069
- name: Build package
70+
working-directory: client-python
6171
run: |
6272
poetry build
6373
- name: Publish to PyPi
6474
uses: pypa/gh-action-pypi-publish@release/v1
6575
with:
66-
packages-dir: dist/
76+
packages-dir: client-python/dist/

.github/workflows/stable.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,26 @@ jobs:
6262
with:
6363
fetch-depth: 0
6464
token: "${{ steps.app-token.outputs.token }}"
65+
path: client-python
6566
- name: Install python and dependencies
6667
run: |
6768
pipx install poetry || true
6869
- name: Setup Python
6970
uses: actions/setup-python@v5
7071
with:
71-
python-version-file: pyproject.toml
72+
python-version-file: client-python/pyproject.toml
73+
- name: Fetch schema
74+
uses: actions/checkout@v5
75+
with:
76+
repository: goauthentik/authentik
77+
token: "${{ steps.app-token.outputs.token }}"
78+
ref: "${{ matrix.tag }}"
79+
path: authentik
80+
sparse-checkout: |
81+
schema.yml
82+
sparse-checkout-cone-mode: false
7283
- name: Publish
84+
working-directory: client-python
7385
run: |
7486
tag="${{ matrix.tag }}"
7587
version="$(echo -n "$tag" | sed 's/version\///')"
@@ -80,25 +92,25 @@ jobs:
8092
git checkout "$branch"
8193
fi
8294
83-
make ref="$tag" version="$version"
95+
make version="$version"
8496
8597
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
8698
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
8799
88100
git add .
89-
git commit -F "diff.test" || exit 0
101+
git commit -m "Version $version" || exit 0
90102
git tag "$tag"
91103
git push origin "$branch"
92104
git push --tags
93105
cargo publish
94-
truncate -s '<125000' diff.test
95-
gh release create "$tag" -F diff.test --latest --title "$version"
106+
gh release create "$tag" --latest --title "$version"
96107
env:
97108
GH_TOKEN: "${{ steps.app-token.outputs.token }}"
98109
- name: Build package
110+
working-directory: client-python
99111
run: |
100112
poetry build
101113
- name: Publish to PyPi
102114
uses: pypa/gh-action-pypi-publish@release/v1
103115
with:
104-
packages-dir: dist/
116+
packages-dir: client-python/dist/

Makefile

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,35 @@ PWD = $(shell pwd)
33
UID = $(shell id -u)
44
GID = $(shell id -g)
55

6-
all: clean build
6+
all: clean update diff build
77

88
clean:
9-
rm -rf src/ docs/
9+
rm -rf src/ docs/ test/
1010

11-
build:
12-
ifndef ref
13-
$(error Usage: make build ref=main version=20xx.xx.xx)
14-
endif
15-
ifndef version
16-
$(error Usage: make build ref=main version=20xx.xx.xx)
17-
endif
11+
update:
1812
mv schema.yml schema-old.yml
19-
wget -O schema.yml "https://raw.githubusercontent.com/goauthentik/authentik/$(ref)/schema.yml"
20-
docker compose -f scripts/docker-compose.yml run --user "${UID}:${GID}" diff \
13+
cp ../authentik/schema.yml schema.yml
14+
15+
diff:
16+
docker compose -f scripts/docker-compose.yml run --rm --user "${UID}:${GID}" diff \
2117
--markdown \
2218
/local/diff.test \
2319
/local/schema-old.yml \
2420
/local/schema.yml
2521
rm schema-old.yml
26-
docker compose -f scripts/docker-compose.yml run --user "${UID}:${GID}" gen \
22+
mv diff.test /tmp/diff.test
23+
echo -e "Update API Client\n\n" > diff.test
24+
cat /tmp/diff.test >> diff.test
25+
26+
build:
27+
ifndef version
28+
$(error Usage: make build version=20xx.xx.xx)
29+
endif
30+
docker compose -f scripts/docker-compose.yml run --rm --user "${UID}:${GID}" gen \
2731
generate \
2832
-i /local/schema.yml \
2933
-g python \
3034
-o /local \
3135
-c /local/config.yaml \
3236
--additional-properties=packageVersion=$(version)
3337
rm -f .travis.yml git_push.sh .gitlab-ci.yml .github/workflows/python.yml
34-
mv diff.test /tmp/diff.test
35-
echo "Update API Client\n\n" > diff.test
36-
cat /tmp/diff.test >> diff.test

0 commit comments

Comments
 (0)