Skip to content

Commit

Permalink
Reworked deployment scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
thefirstspine committed Feb 7, 2024
1 parent b49ccad commit 112a74c
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
48 changes: 48 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Deploy app (dev)
on:
push:
branches:
- 'next'
workflow_dispatch:
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install
run: npm install
- name: Launch tests
run: npm run test
deploy:
name: Deploy app
runs-on: ubuntu-latest
needs: [tests]
steps:
- name: Checkout Ansible
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: thefirstspine/ansible
- name: Get config
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: thefirstspine/ansible-secrets-dev
path: tmp
token: ${{ secrets.ACCESS_TOKEN }}
- name: Get inventory
run: |
rm -rf volume/conf
rm -rf volume/keys
mv tmp/conf volume/conf
mv tmp/keys volume/keys
- name: Build Docker image
run: |
docker build -t thefirstspine/ansible .
- name: Run thefirstspine/ansible image
run: |
docker run --rm -v ./volume:/volume -e BRANCH=next thefirstspine/ansible ansible-playbook -i /volume/conf/inventory.yaml /volume/playbooks/deploy-website.yaml
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ jobs:
docker build -t thefirstspine/ansible .
- name: Run thefirstspine/ansible image
run: |
docker run --rm -v ./volume:/volume thefirstspine/ansible ansible-playbook -i /volume/conf/inventory.yaml /volume/playbooks/deploy-website.yaml
docker run --rm -v ./volume:/volume -e BRANCH=${GITHUB_REF#refs/*/} thefirstspine/ansible ansible-playbook -i /volume/conf/inventory.yaml /volume/playbooks/deploy-website.yaml

0 comments on commit 112a74c

Please sign in to comment.