2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-11-09 23:00:56 +00:00

Update example env after building stable images

This commit is contained in:
Lev Vereshchagin 2021-12-21 14:17:59 +03:00
parent 075df53a33
commit adc526d859
2 changed files with 63 additions and 0 deletions

32
.github/scripts/update_example_env.py vendored Normal file
View File

@ -0,0 +1,32 @@
import os
import re
def get_versions():
frappe_version = os.getenv("FRAPPE_VERSION")
erpnext_version = os.getenv("ERPNEXT_VERSION")
assert frappe_version, "No Frappe version set"
assert erpnext_version, "No ERPNext version set"
return frappe_version, erpnext_version
def update_env(frappe_version: str, erpnext_version: str):
with open("example.env", "r+") as f:
content = f.read()
for env, var in (
("FRAPPE_VERSION", frappe_version),
("ERPNEXT_VERSION", erpnext_version),
):
content = re.sub(rf"{env}=.*", f"{env}={var}", content)
f.seek(0)
f.truncate()
f.write(content)
def main() -> int:
update_env(*get_versions())
return 0
if __name__ == "__main__":
raise SystemExit(main())

View File

@ -53,6 +53,37 @@ jobs:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
update_example_env:
runs-on: ubuntu-latest
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
needs: v13
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Get latest versions
run: python3 ./.github/scripts/get_latest_tags.py --repo erpnext --version 13
- name: Update example.env
run: python3 ./.github/scripts/update_example_env.py
- name: Setup Git Credentials
run: |
git config --global user.name github-actions
git config --global user.email github-actions@github.com
- name: Commit and push
run: |
git add example.env
git commit -m "chore: Update `example.env`"
git push origin main
release_helm:
runs-on: ubuntu-latest
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}