Merge pull request #2456 from prefeiturasp/feature/124082-nao-apagar-… #686
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: Dev - CI/CD | |
on: | |
push: | |
branches: [ develop ] | |
paths-ignore: | |
- ".github/workflows/**" | |
workflow_dispatch: | |
jobs: | |
sonar: | |
runs-on: self-hosted | |
if: ${{ github.ref == 'refs/heads/develop' }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Sonar | |
uses: luizhpriotto/[email protected] | |
env: | |
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_HOST: http://sonar.sme.prefeitura.sp.gov.br/ | |
- name: send failure message | |
if: ${{ failure() }} | |
uses: appleboy/telegram-action@master | |
with: | |
to: -571051431 | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
message: | | |
💥 Failed in ${{ github.ref_name }}! | |
${{ github.actor }} created commit: | |
Commit message: ${{ github.event.commits[0].message }} | |
Repository: ${{ github.repository }} | |
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} | |
Actions: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
build: | |
runs-on: self-hosted | |
if: ${{ github.ref == 'refs/heads/develop' }} | |
needs: [ sonar ] | |
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 . --tag ${{ secrets.REGISTRY_HOST }}/${GITHUB_REF##*/}/ptrf-frontend | |
docker push ${{ secrets.REGISTRY_HOST }}/${GITHUB_REF##*/}/ptrf-frontend | |
- name: send failure message | |
if: ${{ failure() }} | |
uses: appleboy/telegram-action@master | |
with: | |
to: -571051431 | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
message: | | |
💥 Failed in ${{ github.ref_name }}! | |
${{ github.actor }} created commit: | |
Commit message: ${{ github.event.commits[0].message }} | |
Repository: ${{ github.repository }} | |
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} | |
Actions: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
deploy: | |
runs-on: self-hosted | |
needs: [ build ] | |
if: ${{ github.ref == 'refs/heads/develop' }} | |
environment: | |
name: development | |
steps: | |
- name: Redeploy | |
uses: luizhpriotto/[email protected] | |
env: | |
RANCHER_URL: ${{ secrets.RANCHER_URL }} | |
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }} | |
NAMESPACE: sme-ptrf | |
WORKLOAD: ptrf-frontend | |
- name: send failure message | |
if: ${{ failure() }} | |
uses: appleboy/telegram-action@master | |
with: | |
to: -571051431 | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
message: | | |
💥 Failed in ${{ github.ref_name }}! | |
${{ github.actor }} created commit: | |
Commit message: ${{ github.event.commits[0].message }} | |
Repository: ${{ github.repository }} | |
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} | |
Actions: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
- name: send success message | |
if: ${{ success() }} | |
uses: appleboy/telegram-action@master | |
with: | |
to: -571051431 | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
message: | | |
🚀 Success in ${{ github.ref_name }}! | |
${{ github.actor }} created commit: | |
Commit message: ${{ github.event.commits[0].message }} | |
Repository: ${{ github.repository }} | |
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} | |
Actions: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |