-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add automated deploys through GitHub actions... ... maybe
- Loading branch information
1 parent
b29bead
commit 4e9a5f8
Showing
3 changed files
with
51 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,6 @@ | |
# Ignore the payloads | ||
/payloads/*.yml | ||
/payloads/*.txt | ||
|
||
# Ignore the GitHub files | ||
/.github |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Deploy to Hack | ||
on: | ||
# Only run the workflow after a new Docker image is published. | ||
workflow_run: | ||
workflows: | ||
- Publish Docker image | ||
branches: | ||
- main | ||
types: | ||
- completed | ||
jobs: | ||
deploy: | ||
name: "Deploy to Hack" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Configure SSH | ||
run: | | ||
mkdir -p ~/.ssh/ | ||
echo "$SSH_KEY" > ~/.ssh/hack.key | ||
chmod 600 ~/.ssh/hack.key | ||
cat >>~/.ssh/config <<END | ||
Host hack | ||
HostName $SSH_HOST | ||
User $SSH_USER | ||
IdentityFile ~/.ssh/hack.key | ||
StrictHostKeyChecking no | ||
END | ||
env: | ||
SSH_USER: ${{ secrets.HACK_DEPLOY_SSH_USER }} | ||
SSH_KEY: ${{ secrets.HACK_DEPLOY_SSH_KEY }} | ||
SSH_HOST: ${{ secrets.HACK_DEPLOY_SSH_HOST }} | ||
|
||
- name: Kill running Docker containers | ||
run: ssh hack 'docker kill $(docker ps -q)' | ||
|
||
- name: Pull the latest Docker container | ||
run: ssh hack 'docker pull andrewjkerr/bug-bounty-in-a-box:latest' | ||
|
||
- name: Start the new container | ||
run: | | ||
ssh hack ' | ||
docker run -d \ | ||
-v ${{ secrets.BUG_BOUNTY_IN_A_BOX_CONFIG }}:/app/config/application.yml \ | ||
-v ${{ secrets.BUG_BOUNTY_IN_A_BOX_LOGS_DIRECTORY }}:/app/logs/ \ | ||
-p ${{ secrets.BUG_BOUNTY_IN_A_BOX_PORT }}:4567 \ | ||
-e "APP_ENV=production" \ | ||
andrewjkerr/bug-bounty-in-a-box:latest | ||
' |