-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (94 loc) · 3.62 KB
/
main.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
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
name: Build cgp-pygeoapi
on:
push:
branches:
- production
- bo_gh_actions_test
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-and-upload-artifact:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
include:
- python-version: '3.10'
env:
PYGEOAPI_CONFIG: "$(pwd)/pygeoapi-config.yml"
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- name: Clear up GitHub runner diskspace
run: |
echo "Space before"
df -h /
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
echo "Space after"
df -h /
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Setup Python ${{ matrix.python-version }}
with:
python-version: ${{ matrix.python-version }}
- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Install requirements
run: |
pip3 install -r requirements.txt
python3 setup.py install
- name: Build translations
run: |
pybabel extract -F babel-mapping.ini -o locale/messages.pot .
pybabel update -d locale -l en -i locale/messages.pot
pybabel update -d locale -l fr -i locale/messages.pot
pybabel compile -d locale -l en
pybabel compile -d locale -l fr
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install Plugin and Deploy
uses: serverless/github-action@v3.2
with:
# The following only installs the extensions and creates a serverless package.
# To deploy, comment the line below and uncomment the second args line instead.
# Deployment requires AWS credentials
args: -c "serverless plugin install --name serverless-python-requirements && serverless plugin install --name serverless-wsgi && serverless package"
# args: -c "serverless plugin install --name serverless-python-requirements && serverless plugin install --name serverless-wsgi && serverless package && serverless deploy"
entrypoint: /bin/sh
- name: Set current date as env variable
run: echo "NOW=$(date +'%Y%m%d-%H%M')" >> $GITHUB_ENV
- name: Post packaging steps necessary to prevent a twice zipped deployment file
run: |
mkdir temp
unzip -o ${{ github.workspace }}/.serverless/pygeoapi.zip -d temp
- name: Upload zip file artifact
uses: actions/upload-artifact@v4
with:
name: cgp_pygeoapi-${{ env.NOW }}
path: ${{ github.workspace }}/temp
copy-artifact-to-dev-branch:
runs-on: ubuntu-latest
needs: build-and-upload-artifact
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download zipped artifact
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}/temp
- name: Create new dev branch and overwrite artifact with force push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
branch_name="dev-release"
git checkout -b $branch_name
git add ${{ github.workspace }}/temp
git commit -m "Add artifact from workflow run ${{ github.run_id }}"
git push -u origin $branch_name