Update Jenkinsfile #366
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: CI/CD | |
on: | |
push: | |
branches: [ master, homolog, homolog-r2 ] | |
paths-ignore: | |
- ".github/workflows/**" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: self-hosted | |
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-hom: | |
runs-on: self-hosted | |
needs: [ build ] | |
if: ${{ github.ref != 'refs/heads/master' }} | |
environment: | |
name: release | |
steps: | |
- name: Redeploy Hom | |
if: ${{ github.ref == 'refs/heads/homolog' }} | |
uses: luizhpriotto/action_images@kubectl-v2.0 | |
env: | |
RANCHER_URL: ${{ secrets.RANCHER_URL }} | |
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }} | |
NAMESPACE: sme-ptrf | |
WORKLOAD: ptrf-frontend | |
- name: Redeploy Hom2 | |
if: ${{ github.ref == 'refs/heads/homolog-r2' }} | |
uses: luizhpriotto/action_images@kubectl-v2.0 | |
env: | |
RANCHER_URL: ${{ secrets.RANCHER_URL }} | |
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }} | |
NAMESPACE: sme-ptrf-hom2 | |
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 }} | |
deploy-prod: | |
runs-on: self-hosted | |
needs: [ build ] | |
if: ${{ github.ref == 'refs/heads/master' }} | |
environment: | |
name: production | |
steps: | |
- name: Redeploy Prod | |
uses: luizhpriotto/action_images@kubectl-v2.0 | |
env: | |
RANCHER_URL: ${{ secrets.RANCHER_URL }} | |
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }} | |
NAMESPACE: sme-ptrf | |
WORKLOAD: ptrf-frontend | |
- name: Redeploy Treinamento | |
uses: luizhpriotto/action_images@kubectl-v2.0 | |
env: | |
RANCHER_URL: ${{ secrets.RANCHER_URL }} | |
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }} | |
NAMESPACE: sigescola-treinamento | |
WORKLOAD: treinamento-frontend | |
- name: Redeploy Treinamento 2 | |
uses: luizhpriotto/action_images@kubectl-v2.0 | |
env: | |
RANCHER_URL: ${{ secrets.RANCHER_URL }} | |
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }} | |
NAMESPACE: sigescola-treinamento2 | |
WORKLOAD: treinamento-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 }} |