diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..9a48c0bb --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,33 @@ +name: Deploying to heroku + +on: workflow_dispatch + +env: + IMAGE_NAME: web + HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} + CONFIG_FILE_URL: ${{ secrets.CONFIG_FILE_URL }} + +jobs: + build_and_push: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Build the image + run: docker build . --file Dockerfile -t "${IMAGE_NAME}" + + - name: Login into heroku container registry + run: heroku container:login + + - name: Create heroku app name + run: heroku create --region eu ${{ secrets.HEROKU_APP_NAME }} + + - name: Push the image container to heroku + run: heroku container:push "${IMAGE_NAME}" -a ${{ secrets.HEROKU_APP_NAME }} + + - name: Release image to heroku + run: heroku container:release "${IMAGE_NAME}" -a ${{ secrets.HEROKU_APP_NAME }} + + - name: Setting up config env + run: heroku config:set CONFIG_FILE_URL="${CONFIG_FILE_URL}" HEROKU_API_KEY="${HEROKU_API_KEY}" HEROKU_APP_NAME="${{ secrets.HEROKU_APP_NAME }}" -a ${{ secrets.HEROKU_APP_NAME }}