mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-26 00:55:10 +00:00
Update setup_site.yml
This commit is contained in:
parent
3033337583
commit
50f9022722
1 changed files with 60 additions and 53 deletions
111
.github/workflows/setup_site.yml
vendored
111
.github/workflows/setup_site.yml
vendored
|
|
@ -1,70 +1,77 @@
|
||||||
name: setup site base on provided image build for branch specified
|
name: setup site base on provided image build for branch specified
|
||||||
|
|
||||||
|
|
||||||
# on:
|
|
||||||
# workflow_call:
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
# workflow_dispatch:
|
||||||
|
pull_request:
|
||||||
# on:
|
types: [ reopened]
|
||||||
# workflow_run:
|
branches: [main]
|
||||||
# workflows: ["Master Workflow"]
|
|
||||||
# types:
|
|
||||||
# - completed
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
which_branch:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
# extract branch name
|
|
||||||
- name: Extract branch name
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
shell: bash
|
|
||||||
run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/})"
|
|
||||||
id: extract_branch
|
|
||||||
|
|
||||||
# extract branch name on pull request
|
job-image-build:
|
||||||
- name: Print branch name
|
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_HEAD_REF})"
|
|
||||||
|
|
||||||
# print branch name
|
|
||||||
- name: Get branch name
|
|
||||||
run: echo 'The branch name is' $BRANCH_NAME
|
|
||||||
|
|
||||||
setup_sites:
|
|
||||||
runs-on:
|
runs-on:
|
||||||
- self-hosted
|
- self-hosted
|
||||||
|
# steps:
|
||||||
|
# # extract branch name
|
||||||
|
# - name: Extract branch name
|
||||||
|
# if: github.event_name != 'pull_request'
|
||||||
|
# shell: bash
|
||||||
|
# run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/})"
|
||||||
|
# id: extract_branch
|
||||||
|
|
||||||
|
# # extract branch name on pull request
|
||||||
|
# - name: Print branch name
|
||||||
|
# if: github.event_name == 'pull_request'
|
||||||
|
# run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_HEAD_REF})"
|
||||||
|
|
||||||
|
# # print branch name
|
||||||
|
# - name: Get branch name
|
||||||
|
# run: echo 'The branch name is' $BRANCH_NAME
|
||||||
|
|
||||||
|
# setup_sites:
|
||||||
|
# runs-on:
|
||||||
|
# - self-hosted
|
||||||
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Create first bench
|
|
||||||
run: |
|
|
||||||
echo 'The branch name is' $BRANCH_NAME
|
|
||||||
cp example.env ~/gitopss/erpnext-one.env
|
|
||||||
sed -i 's/DB_PASSWORD=123/DB_PASSWORD=fintech2023/g' ~/gitopss/erpnext-one.env
|
|
||||||
sed -i 's/DB_HOST=/DB_HOST=mariadb-database/g' ~/gitopss/erpnext-one.env
|
|
||||||
sed -i 's/DB_PORT=/DB_PORT=3306/g' ~/gitopss/erpnext-one.env
|
|
||||||
sed -i 's/SITES=`erp.fintechsys.net`/SITES=\`agent.fintechsys.net\`/g' ~/gitopss/erpnext-one.env
|
|
||||||
echo 'ROUTER=erpnext-one' >> ~/gitopss/erpnext-one.env
|
|
||||||
echo "BENCH_NETWORK=erpnext-one" >> ~/gitopss/erpnext-one.env
|
|
||||||
|
|
||||||
- name: Create a yaml file to deploy container
|
|
||||||
run: |
|
|
||||||
docker compose --project-name erpnext-one \
|
|
||||||
--env-file ~/gitopss/erpnext-one.env \
|
|
||||||
-f compose.yaml \
|
|
||||||
-f overrides/compose.redis.yaml \
|
|
||||||
-f overrides/compose.multi-bench.yaml \
|
|
||||||
-f overrides/compose.multi-bench-ssl.yaml config > ~/gitopss/erpnext-one.yaml
|
|
||||||
|
|
||||||
|
|
||||||
- name: Deploy the container
|
- name: Create the site
|
||||||
run: |
|
run: |
|
||||||
docker compose --project-name erpnext-one -f ~/gitopss/erpnext-one.yaml up -d
|
docker-compose --project-name ${{ github.event.pull_request.head.ref }} exec backend \
|
||||||
|
bench new-site --no-mariadb-socket --admin-password=${{ vars.MARIADB_PASSWORD }} --db-root-password=${{ vars.MARIADB_PASSWORD }} --install-app erpnext --set-default ${{ github.event.pull_request.head.ref }}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# - name: Create first bench
|
||||||
|
# run: |
|
||||||
|
# echo 'The branch name is' $BRANCH_NAME
|
||||||
|
# cp example.env ~/gitopss/erpnext-one.env
|
||||||
|
# sed -i 's/DB_PASSWORD=123/DB_PASSWORD=fintech2023/g' ~/gitopss/erpnext-one.env
|
||||||
|
# sed -i 's/DB_HOST=/DB_HOST=mariadb-database/g' ~/gitopss/erpnext-one.env
|
||||||
|
# sed -i 's/DB_PORT=/DB_PORT=3306/g' ~/gitopss/erpnext-one.env
|
||||||
|
# sed -i 's/SITES=`erp.fintechsys.net`/SITES=\`agent.fintechsys.net\`/g' ~/gitopss/erpnext-one.env
|
||||||
|
# echo 'ROUTER=erpnext-one' >> ~/gitopss/erpnext-one.env
|
||||||
|
# echo "BENCH_NETWORK=erpnext-one" >> ~/gitopss/erpnext-one.env
|
||||||
|
|
||||||
|
# - name: Create a yaml file to deploy container
|
||||||
|
# run: |
|
||||||
|
# docker compose --project-name erpnext-one \
|
||||||
|
# --env-file ~/gitopss/erpnext-one.env \
|
||||||
|
# -f compose.yaml \
|
||||||
|
# -f overrides/compose.redis.yaml \
|
||||||
|
# -f overrides/compose.multi-bench.yaml \
|
||||||
|
# -f overrides/compose.multi-bench-ssl.yaml config > ~/gitopss/erpnext-one.yaml
|
||||||
|
|
||||||
|
|
||||||
|
# - name: Deploy the container
|
||||||
|
# run: |
|
||||||
|
# docker compose --project-name erpnext-one -f ~/gitopss/erpnext-one.yaml up -d
|
||||||
|
|
||||||
|
|
||||||
- name: Create the site
|
- name: Create the site
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue