Skip to content

Commit

Permalink
Autodeploy auth (#451)
Browse files Browse the repository at this point in the history
* Add autodeploy github actions step with nginx auth script

* Change branch name from master to main

* Update minor fixes for the githubactions pipeline

* Update minor fix in github actions dependencies

* Change name of env var TARGET_BRANCH to TARGET_ENV

* Change name of github action step

* Change condition of autodeploy step

* Remove unnecessary dependency for job
  • Loading branch information
gMonty030 authored Mar 16, 2022
1 parent 86af4a0 commit 910726a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,16 @@ jobs:
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

autodeploy:
runs-on: ubuntu-latest
needs: [docker-publish]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- name: Deploy Staging
run: bash scripts/autodeploy.sh
env:
AUTODEPLOY_URL: ${{ secrets.AUTODEPLOY_URL }}
AUTODEPLOY_TOKEN: ${{ secrets.AUTODEPLOY_TOKEN }}
TARGET_ENV: "staging"
10 changes: 10 additions & 0 deletions scripts/autodeploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -ev

curl -s --output /dev/null --write-out "%{http_code}" \
-H "Content-Type: application/json" \
-X POST \
-u "$AUTODEPLOY_TOKEN" \
-d '{"push_data": {"tag": "'$TARGET_ENV'" }}' \
$AUTODEPLOY_URL

0 comments on commit 910726a

Please sign in to comment.