Skip to content

Commit

Permalink
feat(ci): deploy for frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
akorzunin committed Jul 31, 2024
1 parent 69628c8 commit 827c7c5
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
31 changes: 31 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,34 @@ jobs:
file: ./web/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

deploy-frontend:
name: Deploy frontend Docker image
runs-on: ubuntu-latest
environment: dev
needs:
- build-frontend
defaults:
run:
working-directory: deploy/dev
steps:
- name: Check out the repo
uses: actions/checkout@v4.1.7

- name: Run playbook
uses: dawidd6/action-ansible-playbook@v2.8.0
with:
playbook: deploy_frontend.yaml
directory: deploy/dev
configuration: |
[defaults]
callbacks_enabled = ansible.posix.profile_tasks, ansible.posix.timer
stdout_callback = yaml
host_key_checking = false
interpreter_python = /usr/bin/python
vault_password: ${{ secrets.ANSIBLE_PASS }}
inventory: ${{ vars.ANSIBLE_HOSTS }}
options: |
--inventory .hosts
--limit ${{ vars.DEV_SERVER }}
--verbose
29 changes: 29 additions & 0 deletions deploy/dev/deploy_frontend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
- name: Deploy dev
hosts: all
become: false
vars:
project_dir: ~/Documents/supericosahedron-dev/

tasks:
- name: Copy files to service directory
ansible.builtin.copy:
src: "{{ item }}"
dest: "{{ project_dir }}"
mode: "0755"
backup: false
remote_src: false
loop:
- Caddyfile
- compose.yaml

- name: Deploy file server
ansible.builtin.command:
cmd: docker compose up -d --force-recreate
register: out
changed_when: out.rc != 0

- name: Remove old version of image
ansible.builtin.command:
cmd: docker image prune --filter="dangling=true" --force
register: out
changed_when: out.rc != 0
2 changes: 1 addition & 1 deletion web/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const Header = () => {
</h2>
<div className="flex gap-3">
<Button asChild>
<a href="/download/">download_6</a>
<a href="/download/">download_8</a>
</Button>
<Button>source code</Button>
<Button disabled>steam</Button>
Expand Down

0 comments on commit 827c7c5

Please sign in to comment.