-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (74 loc) · 2.99 KB
/
build-pygluu.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
name: build-pygluu
# This builds, packages and releases pygluu-kubernetes
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
publish:
permissions:
contents: write
name: Publish for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
name: ubuntu
- os: macos-latest
name: macos
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install jq cffi
- name: Lint with flake8
working-directory: ./cloud-native-edition
run: |
pip3 install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Build pygluu-kubernetes
working-directory: ./cloud-native-edition
run: |
sudo apt-get update || brew install jq
sudo apt-get install build-essential || echo "Maybe im on macos OS"
pip3 install shiv
make zipapp
- name: Build pygluu-compose
working-directory: ./community-edition-containers
run: |
make zipapp
mv pygluu-compose.pyz ../cloud-native-edition/pygluu-compose.pyz
- name: Get project
id: project
run: |
echo "gituser=$(python3 -c 'import os ; REPO = os.environ.get("GITHUB_REPOSITORY") ; print(str(REPO).split("/")[0])')" >> $GITHUB_OUTPUT
echo "gitproject=$(python3 -c 'import os ; REPO = os.environ.get("GITHUB_REPOSITORY") ; print(str(REPO).split("/")[1])')" >> $GITHUB_OUTPUT
- name: Get latest tag and print version
id: previoustag
run: |
echo "tag=$(curl https://api.github.com/repos/${{ steps.project.outputs.gituser }}/${{ steps.project.outputs.gitproject }}/releases/latest -s | grep "tag_name" | cut -d '"' -f 4)" >> $GITHUB_OUTPUT
echo "${{ steps.previoustag.outputs.tag }}"
- name: upload
id: sha
working-directory: ./cloud-native-edition
run: |
TAG=$(echo ${{ github.event.ref }} | cut -d '/' -f 3)
VERSION="${TAG}"
mv pygluu-kubernetes.pyz pygluu-kubernetes-${{ matrix.name }}-amd64.pyz
mv pygluu-compose.pyz pygluu-compose-${{ matrix.name }}-amd64.pyz
sha256sum pygluu-kubernetes-${{ matrix.name }}-amd64.pyz > pygluu-kubernetes-${{ matrix.name }}-amd64.pyz.sha256sum
sha256sum pygluu-compose-${{ matrix.name }}-amd64.pyz > pygluu-compose-${{ matrix.name }}-amd64.pyz.sha256sum
echo "${{ secrets.MOWORKFLOWTOKEN }}" | gh auth login --with-token
gh release upload "${VERSION}" *.pyz *.sha256sum