Update example env after building stable images
This commit is contained in:
32
.github/scripts/update_example_env.py
vendored
Normal file
32
.github/scripts/update_example_env.py
vendored
Normal 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())
|
||||||
31
.github/workflows/build_stable.yml
vendored
31
.github/workflows/build_stable.yml
vendored
@@ -53,6 +53,37 @@ jobs:
|
|||||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
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:
|
release_helm:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
|
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
|
||||||
|
|||||||
Reference in New Issue
Block a user