Skip to content

Commit

Permalink
ci: everything together, and dry run
Browse files Browse the repository at this point in the history
  • Loading branch information
mahesh-naxa committed Sep 16, 2024
1 parent aed94fd commit f6658b2
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 72 deletions.
118 changes: 59 additions & 59 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,67 +33,67 @@ jobs:
env_file_path: tasking-manager.env
secrets: inherit

# backend-build:
# uses: hotosm/gh-workflows/.github/workflows/[email protected]
# with:
# context: .
# build_target: prod
# image_name: ghcr.io/${{ github.repository }}/backend
# dockerfile: Dockerfile
# scan_image: false
# secrets: inherit
backend-build:
uses: hotosm/gh-workflows/.github/workflows/[email protected]
with:
context: .
build_target: prod
image_name: ghcr.io/${{ github.repository }}/backend
dockerfile: Dockerfile
scan_image: false
secrets: inherit

# frontend-test:
# uses: naxa-developers/tasking-manager/.github/workflows/frontend-test.yml@ci-gh-workflows
# secrets: inherit
# with:
# node-version: 16.x
# context: ./frontend
# cache-key-file: ./frontend/yarn.lock
# package-manager: yarn
# test_frontend_command: |
# CI=true yarn test -w 1
# # test_frontend_build: false
# # build_test_frontend_command: |
# # CI=true GENERATE_SOURCEMAP=false yarn build
frontend-test:
uses: naxa-developers/tasking-manager/.github/workflows/frontend-test.yml@ci-gh-workflows
secrets: inherit
with:
node-version: 16.x
context: ./frontend
cache-key-file: ./frontend/yarn.lock
package-manager: yarn
test_frontend_command: |
CI=true yarn test -w 1
# test_frontend_build: false
# build_test_frontend_command: |
# CI=true GENERATE_SOURCEMAP=false yarn build

# frontend-build:
# uses: naxa-developers/tasking-manager/.github/workflows/frontend-build.yml@ci-gh-workflows
# secrets: inherit
# with:
# node-version: 16.x
# context: ./frontend
# cache-key-file: ./frontend/yarn.lock
# package-manager: yarn
# build-dist-folder-path: ./frontend/build
frontend-build:
uses: naxa-developers/tasking-manager/.github/workflows/frontend-build.yml@ci-gh-workflows
secrets: inherit
with:
node-version: 16.x
context: ./frontend
cache-key-file: ./frontend/yarn.lock
package-manager: yarn
build-dist-folder-path: ./frontend/build

# frontend-deploy:
# runs-on: ubuntu-latest
# needs:
# - frontend-test
# - frontend-build
# name: Deploy Frontend Static Files
# steps:
# - name: Download build artifacts
# uses: actions/download-artifact@v4
# with:
# name: ${{ needs.frontend-build.outputs.artifact-name }}
# path: ./build
frontend-deploy:
runs-on: ubuntu-latest
needs:
- frontend-test
- frontend-build
name: Deploy Frontend Static Files
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: ${{ needs.frontend-build.outputs.artifact-name }}
path: ./build

# - name: Debug check files
# run: |
# ls -alh
# ls -alh build
- name: Debug check files
run: |
ls -alh
ls -alh build
# backend_deploy_to_vm:
# name: Deploy Backend to VM
# needs:
# - backend-test
# - backend-build
# uses: naxa-developers/tasking-manager/.github/workflows/remote_deploy_compose.yml@ci-gh-workflows
# with:
# docker_compose_file: docker-compose.yml
# environment: ${{ github.ref_name }}
# example_env_file_path: example.env
# env_file_path: tasking-manager.env
# secrets: inherit
backend_deploy_to_vm:
name: Deploy Backend to VM
needs:
- backend-test
- backend-build
uses: naxa-developers/tasking-manager/.github/workflows/remote_deploy_compose.yml@ci-gh-workflows
with:
docker_compose_file: docker-compose.yml
environment: ${{ github.ref_name }}
example_env_file_path: example.env
env_file_path: tasking-manager.env
secrets: inherit
26 changes: 13 additions & 13 deletions .github/workflows/remote_deploy_compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,18 @@ jobs:
echo "GIT_BRANCH=${GIT_BRANCH}" >> ${{ inputs.env_file_path }}
echo "TAG_OVERRIDE=${TAG_OVERRIDE}" >> ${{ inputs.env_file_path }}
- uses: webfactory/[email protected]
with:
ssh-private-key: "${{ secrets.SSH_PRIVATE_KEY }}"
# - uses: webfactory/[email protected]
# with:
# ssh-private-key: "${{ secrets.SSH_PRIVATE_KEY }}"

- name: Add host keys to known_hosts
run: |
ssh-keyscan "${{ vars.SSH_HOST }}" >> ~/.ssh/known_hosts
# - name: Add host keys to known_hosts
# run: |
# ssh-keyscan "${{ vars.SSH_HOST }}" >> ~/.ssh/known_hosts

- name: Deploy
run: |
docker compose --file ${{ inputs.docker_compose_file }} pull
docker compose --file ${{ inputs.docker_compose_file }} up \
--detach --remove-orphans --force-recreate
env:
DOCKER_HOST: "ssh://${{ vars.SSH_USER }}@${{ vars.SSH_HOST }}"
# - name: Deploy
# run: |
# docker compose --file ${{ inputs.docker_compose_file }} pull
# docker compose --file ${{ inputs.docker_compose_file }} up \
# --detach --remove-orphans --force-recreate
# env:
# DOCKER_HOST: "ssh://${{ vars.SSH_USER }}@${{ vars.SSH_HOST }}"

0 comments on commit f6658b2

Please sign in to comment.