forked from HIRO-MicroDataCenters-BV/template-python
-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (72 loc) · 2.52 KB
/
Copy pathbuild_web.yaml
File metadata and controls
89 lines (72 loc) · 2.52 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
name: Build web
on:
workflow_call:
env:
REGISTRY: ghcr.io
jobs:
build_web:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install poetry
run: pip install poetry
- name: Install Helm
uses: azure/setup-helm@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64, linux/arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Make versions
run: |
chmod +x ./tools/version.sh
./tools/version.sh "${{ github.sha }}" "${{ env.REGISTRY }}/${{ vars.DOCKER_IMAGE_NAME }}"
echo "APP_VERSION=$(cat "./VERSION")" >> $GITHUB_ENV
echo "DOCKER_IMAGES=$(cat "./DOCKER_IMAGES")" >> $GITHUB_ENV
echo "DOCKER_TAGS=$(cat "./VERSION_DOCKER")" >> $GITHUB_ENV
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ vars.DOCKER_IMAGE_NAME }}
tags: ${{ env.DOCKER_TAGS }}
- name: Build and push docker image
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ env.DOCKER_IMAGES }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64, linux/arm64
- name: Install dependencies
run: |
poetry config virtualenvs.in-project true
poetry install --no-root --with dev
- name: Generate openapi.yaml
run: poetry run python ./tools/extract_openapi.py app.main:app --app-dir . --out ./openapi.yaml --app_version "${{ env.APP_VERSION }}"
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Create a github release
run: gh release create "${{ env.APP_VERSION }}" ./openapi.yaml
env:
GH_TOKEN: ${{ github.token }}
- name: Publish Helm charts
uses: stefanprodan/helm-gh-pages@master
with:
token: ${{ github.token }}
target_dir: "./helm-charts/"