-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f09afad
commit e866597
Showing
3 changed files
with
65 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,72 +35,6 @@ jobs: | |
runs-on: wgd-dev | ||
|
||
steps: | ||
- name: Extract branch name | ||
shell: bash | ||
run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" | ||
- name: Test | ||
run: echo "${BRANCH_NAME}" | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js 20.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: npm | ||
|
||
- name: Build action runner | ||
run: docker build -t "wgd-action-runner:${BRANCH_NAME}" --build-arg "GIT_SHA=${GITHUB_SHA}" apps/wgd-action-runner | ||
|
||
- name: Build hugo docs | ||
run: | | ||
docker run \ | ||
-v "${GITHUB_WORKSPACE}/hugo:/site" \ | ||
-v "${GITHUB_WORKSPACE}/website:/website" \ | ||
-v "/var/www/${BRANCH_NAME}.wikigdrive.com:/dist/hugo" \ | ||
--env CONFIG_TOML="/site/config/_default/config.toml" --env BASE_URL="https://${BRANCH_NAME}.wikigdrive.com" \ | ||
wgd-action-runner:${BRANCH_NAME} /steps/step_render_hugo | ||
- name: Copy index for vite | ||
run: mkdir -p ${GITHUB_WORKSPACE}/dist/hugo && cp -rf /var/www/${BRANCH_NAME}.wikigdrive.com/* ${GITHUB_WORKSPACE}/dist/hugo | ||
|
||
- uses: whoan/docker-build-with-cache-action@v5 | ||
with: | ||
image_name: "wikigdrive-feature" | ||
image_tag: "${{ github.sha }}" | ||
push_image_and_stages: false | ||
build_extra_args: "{'--build-arg': 'GIT_SHA=${{ github.sha }}'}" | ||
|
||
- name: Stop and remove | ||
run: docker stop "wikigdrive-${BRANCH_NAME}" ; docker rm "wikigdrive-${BRANCH_NAME}" | ||
continue-on-error: true | ||
|
||
- name: "Create empty volume" | ||
run: docker volume rm -f "wikiGDrive${BRANCH_NAME}" ; docker volume create "wikiGDrive${BRANCH_NAME}" | ||
|
||
- name: Start | ||
run: | | ||
docker run -d --name "wikigdrive-${BRANCH_NAME}" \ | ||
--restart unless-stopped \ | ||
--network nginx \ | ||
-v "wikiGDrive${BRANCH_NAME}":/data \ | ||
-v /home/wikigdrive/service_account.json:/service_account.json \ | ||
-v /home/wikigdrive/env.develop:/usr/src/app/.env \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
-v "/var/www/${BRANCH_NAME}.wikigdrive.com:/usr/src/app/dist/hugo" \ | ||
-e "GIT_SHA=${GITHUB_SHA}" \ | ||
-e "ZIPKIN_URL=https://${BRANCH_NAME}.wikigdrive.com/zipkin" \ | ||
-e "ZIPKIN_SERVICE=wikigdrive-${BRANCH_NAME}" \ | ||
--link=zipkin:zipkin \ | ||
"wikigdrive-feature:${GITHUB_SHA}" wikigdrive \ | ||
--service_account /service_account.json \ | ||
--share_email [email protected] \ | ||
--workdir /data \ | ||
server 3000 | ||
- name: "Nginx setup" | ||
run: "TODO" | ||
|
||
- name: Create pull request | ||
id: open-pr | ||
uses: repo-sync/pull-request@v2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,10 @@ name: Pull request created | |
on: | ||
pull_request: | ||
branches: [ master ] | ||
types: [submitted, edited, synchronize] | ||
|
||
jobs: | ||
build: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
@@ -29,43 +30,68 @@ jobs: | |
- name: Test | ||
run: npm run test | ||
|
||
test: | ||
build: | ||
needs: test | ||
runs-on: wgd-dev | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js 20.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: npm | ||
|
||
- name: Build action runner | ||
run: docker build -t "wgd-action-runner:test" --build-arg "GIT_SHA=${GITHUB_SHA}" apps/wgd-action-runner | ||
|
||
- name: Build hugo docs | ||
run: | | ||
docker run \ | ||
-v "${GITHUB_WORKSPACE}/hugo:/site" \ | ||
-v "${GITHUB_WORKSPACE}/website:/website" \ | ||
-v "/var/www/test.wikigdrive.com:/dist/hugo" \ | ||
--env CONFIG_TOML="/site/config/_default/config.toml" --env BASE_URL="https://test.wikigdrive.com" \ | ||
wgd-action-runner:test /steps/step_render_hugo | ||
- name: Copy index for vite | ||
run: mkdir -p dist/hugo && cp -rf /var/www/test.wikigdrive.com/* dist/hugo | ||
|
||
- name: Build | ||
run: docker build -t wikigdrive-test --build-arg "GIT_SHA=${GITHUB_SHA}" . | ||
|
||
- name: Stop | ||
run: docker stop wikigdrive-test | ||
continue-on-error: true | ||
|
||
- name: Remove | ||
run: docker rm wikigdrive-test | ||
continue-on-error: true | ||
|
||
- name: Start | ||
run: docker run -t -v wikiGDriveExample:/data -v /home/wikigdrive/service_account.json:/service_account.json -v "/var/www/dev.wikigdrive.com:/usr/src/app/dist/hugo" wikigdrive-test wikigdrive --service_account /service_account.json --share_email [email protected] --transform_subdir / --workdir /data pull 0AIkOKXbzWCtSUk9PVA | ||
- name: Test | ||
run: echo "${{ github.event.number }}" | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js 20.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: npm | ||
|
||
- name: Build action runner | ||
run: docker build -t "wgd-action-runner:pr-${{ github.event.number }}" --build-arg "GIT_SHA=${GITHUB_SHA}" apps/wgd-action-runner | ||
|
||
- name: Build hugo docs | ||
run: | | ||
docker run \ | ||
-v "${GITHUB_WORKSPACE}/hugo:/site" \ | ||
-v "${GITHUB_WORKSPACE}/website:/website" \ | ||
-v "/var/www/pr-${{ github.event.number }}.wikigdrive.com:/dist/hugo" \ | ||
--env CONFIG_TOML="/site/config/_default/config.toml" --env BASE_URL="https://pr-${{ github.event.number }}.wikigdrive.com" \ | ||
wgd-action-runner:pr-${{ github.event.number }} /steps/step_render_hugo | ||
- name: Copy index for vite | ||
run: mkdir -p ${GITHUB_WORKSPACE}/dist/hugo && cp -rf /var/www/pr-${{ github.event.number }}.wikigdrive.com/* ${GITHUB_WORKSPACE}/dist/hugo | ||
|
||
- name: build | ||
uses: whoan/docker-build-with-cache-action@v5 | ||
with: | ||
image_name: "wikigdrive-feature" | ||
image_tag: "${{ github.sha }}" | ||
push_image_and_stages: false | ||
build_extra_args: "{'--build-arg': 'GIT_SHA=${{ github.sha }}'}" | ||
|
||
- name: Stop and remove | ||
run: docker stop "pr-${{ github.event.number }}" ; docker rm "pr-${{ github.event.number }}" | ||
continue-on-error: true | ||
|
||
- name: "Create empty volume" | ||
run: docker volume rm -f "pr-${{ github.event.number }}" ; docker volume create "pr-${{ github.event.number }}" | ||
|
||
- name: Start | ||
run: | | ||
docker run -d --name "pr-${{ github.event.number }}" \ | ||
--restart unless-stopped \ | ||
--network nginx \ | ||
-v "pr-${{ github.event.number }}":/data \ | ||
-v /home/wikigdrive/service_account.json:/service_account.json \ | ||
-v /home/wikigdrive/env.develop:/usr/src/app/.env \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
-v "/var/www/pr-${{ github.event.number }}.wikigdrive.com:/usr/src/app/dist/hugo" \ | ||
-e "GIT_SHA=${GITHUB_SHA}" \ | ||
-e "ZIPKIN_URL=https://pr-${{ github.event.number }}.wikigdrive.com/zipkin" \ | ||
-e "ZIPKIN_SERVICE=pr-${{ github.event.number }}" \ | ||
--link=zipkin:zipkin \ | ||
"wikigdrive-feature:${GITHUB_SHA}" wikigdrive \ | ||
--service_account /service_account.json \ | ||
--share_email [email protected] \ | ||
--workdir /data \ | ||
server 8080 |