added POST option #9
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
name: Deploy docker starting | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
# Env variable | |
env: | |
DOCKER_USER: ${{secrets.DOCKER_USER}} | |
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} | |
REPO_NAME: ${{secrets.REPO_NAME}} | |
deploy_url: ${{ secrets.RENDER_DEPLOY_HOOK_URL }} | |
jobs: | |
push-image-to-docker-hub: # job name | |
runs-on: ubuntu-latest # runner name : (ubuntu latest version) | |
steps: | |
- uses: actions/checkout@v2 # first action : checkout source code | |
- name: docker login | |
#run: docker login -u $DOCKER_USER -p $DOCKER_PASSWORD | |
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USER }}" --password-stdin | |
- name: Get current date # get the date of the build | |
id: date | |
run: echo "date=$(date +'%Y-%m-%d--%M-%S')" >> $GITHUB_OUTPUT | |
- name: Build the Docker image # push The image to the docker hub | |
run: docker build backend/ --file backend/Dockerfile --tag $DOCKER_USER/$REPO_NAME:2.0 | |
- name: Docker Push | |
run: docker push $DOCKER_USER/$REPO_NAME:2.0 | |
# https://render.com/docs/deploy-hooks#using-with-github-actions | |
- name: Deploy on Render | |
run: | |
curl "$deploy_url" |