Skip to content

Commit

Permalink
Fix deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
ggodlewski committed Jul 19, 2024
1 parent c7b08f7 commit 8e86d6a
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 75 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/DevelopServerDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,11 @@ jobs:
- name: Copy index for vite
run: mkdir -p ${GITHUB_WORKSPACE}/dist/hugo && cp -rf /var/www/dev.wikigdrive.com/* ${GITHUB_WORKSPACE}/dist/hugo

- uses: whoan/docker-build-with-cache-action@v8
- uses: docker/build-push-action@v6
with:
image_name: "wikigdrive-develop"
image_tag: "${{ github.sha }},latest"
push_image_and_stages: false
build_extra_args: "{'--build-arg': 'GIT_SHA=${{ github.sha }}'}"
tags: "wikigdrive-develop:${{ github.sha }},wikigdrive-develop:latest"
push: false
build-args: "{'--build-arg': 'GIT_SHA=${{ github.sha }}'}"

- name: Stop and remove
run: docker stop wikigdrive-develop ; docker rm wikigdrive-develop
Expand All @@ -71,7 +70,7 @@ jobs:
- name: Start
run: |
docker run -d --name wikigdrive-develop \
--restart unless-stopped --restart-delay 30s \
--restart unless-stopped \
--network nginx \
-v wikiGDriveDevelop:/data \
-v /home/wikigdrive/service_account.json:/service_account.json \
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/ProdServerDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,11 @@ jobs:
- name: Copy index for vite
run: mkdir -p ${GITHUB_WORKSPACE}/dist/hugo && cp -rf /var/www/wikigdrive.com/* ${GITHUB_WORKSPACE}/dist/hugo

- uses: whoan/docker-build-with-cache-action@v8
- uses: docker/build-push-action@v6
with:
image_name: "wikigdrive-prod"
image_tag: "${{ github.sha }},latest"
push_image_and_stages: false
build_extra_args: "{'--build-arg': 'GIT_SHA=${{ github.sha }}'}"
tags: "wikigdrive-prod:${{ github.sha }},wikigdrive-prod:latest"
push: false
build-args: "{'--build-arg': 'GIT_SHA=${{ github.sha }}'}"

- name: Stop and remove
run: docker stop wikigdrive-prod ; docker rm wikigdrive-prod
Expand All @@ -79,7 +78,7 @@ jobs:
-v "/var/www/wikigdrive.com:/usr/src/app/dist/hugo" \
-e "GIT_SHA=${GITHUB_SHA}" \
--publish 127.0.0.1:3000:3000 \
--restart unless-stopped --restart-delay 30s \
--restart unless-stopped \
"wikigdrive-prod:${GITHUB_SHA}" wikigdrive \
--service_account /service_account.json \
--share_email [email protected] \
Expand Down
122 changes: 59 additions & 63 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,66 +35,62 @@ jobs:
runs-on: wgd-dev

steps:
- name: Test
run: echo "${{ github.event.number }}"

- uses: actions/checkout@v4

- 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@v8
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 --restart-delay 30s \
--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 }}" \
-e "AUTH_DOMAIN=https://dev.wikigdrive.com" \
-e "AUTH_INSTANCE=pr-${{ github.event.number }}" \
-e "DOMAIN=https://pr-${{ github.event.number }}.wikigdrive.com" \
--link=zipkin:zipkin \
"wikigdrive-feature:${{ github.sha }}" wikigdrive \
--service_account /service_account.json \
--share_email [email protected] \
--workdir /data \
server 3000
- uses: actions/checkout@v4

- 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: docker/build-push-action@v6
with:
tags: "wikigdrive-feature:${{ github.sha }}"
push: false
build-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 }}" \
-e "AUTH_DOMAIN=https://dev.wikigdrive.com" \
-e "AUTH_INSTANCE=pr-${{ github.event.number }}" \
-e "DOMAIN=https://pr-${{ github.event.number }}.wikigdrive.com" \
--link=zipkin:zipkin \
"wikigdrive-feature:${{ github.sha }}" wikigdrive \
--service_account /service_account.json \
--share_email [email protected] \
--workdir /data \
server 3000

0 comments on commit 8e86d6a

Please sign in to comment.