Merge pull request #616 from prefeiturasp/liberacao/release-to-master #476
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: Docker Image CI - Others | |
on: | |
push: | |
branches: [ main, master, release ] | |
paths-ignore: | |
- ".github/workflows/**" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: master | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Login to registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ secrets.REGISTRY_HOST }} | |
username: ${{ secrets.REGISTRY_USER }} | |
password: ${{ secrets.REGISTRY_PWD }} | |
- name: Build the Docker image | |
run: | | |
docker build . --file src/SME.SERAp.Prova.Api/Dockerfile --tag ${{ secrets.REGISTRY_HOST }}/${GITHUB_REF##*/}/sme-prova-serap-api | |
docker push ${{ secrets.REGISTRY_HOST }}/${GITHUB_REF##*/}/sme-prova-serap-api | |
flyway-release: | |
runs-on: master | |
if: ${{ github.ref == 'refs/heads/release' }} | |
needs: [ build ] | |
environment: | |
name: release | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Executando Scripts | |
env: | |
USER_DB: ${{ secrets.USER_DB }} | |
PASSWORD_DB: ${{ secrets.PASSWORD_DB }} | |
URL_DB: ${{ secrets.URL_DB }} | |
run: docker run --rm -v $PWD/scripts:/flyway/sql boxfuse/flyway:5.2.4 -user=$USER_DB -password=$PASSWORD_DB -url=$URL_DB -outOfOrder=true migrate | |
deploy-release: | |
runs-on: master | |
if: ${{ github.ref == 'refs/heads/release' }} | |
needs: [ flyway-release ] | |
environment: | |
name: release | |
steps: | |
- name: Redeploy | |
uses: luizhpriotto/[email protected] | |
env: | |
RANCHER_URL: ${{ secrets.RANCHER_URL }} | |
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }} | |
WORKLOAD: sme-prova-serap-api | |
NAMESPACE: sme-serap-estudante | |
flyway-master: | |
runs-on: master | |
if: ${{ github.ref == 'refs/heads/master' }} | |
needs: [ build ] | |
environment: | |
name: production | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Executando Scripts | |
env: | |
USER_DB: ${{ secrets.USER_DB }} | |
PASSWORD_DB: ${{ secrets.PASSWORD_DB }} | |
URL_DB: ${{ secrets.URL_DB }} | |
run: docker run --rm -v $PWD/scripts:/flyway/sql boxfuse/flyway:5.2.4 -user=$USER_DB -password=$PASSWORD_DB -url=$URL_DB -outOfOrder=true migrate | |
deploy-master: | |
runs-on: master | |
if: ${{ github.ref == 'refs/heads/master' }} | |
needs: [ flyway-master ] | |
environment: | |
name: production | |
steps: | |
- name: Redeploy | |
uses: luizhpriotto/[email protected] | |
env: | |
RANCHER_URL: ${{ secrets.RANCHER_URL }} | |
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }} | |
WORKLOAD: sme-prova-serap-api | |
NAMESPACE: sme-serap-estudante | |