v2.11.0 #26
Workflow file for this run
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 App service | |
on: | |
push: | |
tags: | |
- v* | |
jobs: | |
vars: | |
runs-on: ubuntu-latest | |
steps: | |
- id: tag_version | |
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) | |
outputs: | |
version: ${{ steps.tag_version.outputs.VERSION }} | |
image: ${{ github.repository }}-app:${{ steps.tag_version.outputs.VERSION }} | |
build: | |
needs: [vars] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- uses: docker/build-push-action@v2 | |
id: docker_build | |
with: | |
context: . | |
push: true | |
file: services/app/Dockerfile | |
tags: ${{ needs.vars.outputs.image }} | |
- | |
name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} | |
deploy: | |
runs-on: ubuntu-latest | |
needs: [vars, build] | |
steps: | |
- uses: 8398a7/action-slack@v3 | |
with: | |
status: custom | |
fields: repo,ref,author | |
custom_payload: | | |
{ | |
attachments: [{ | |
color: '#1d9bd1', | |
text: `Deployment of ${process.env.AS_REPO}@${process.env.AS_REF} by ${process.env.AS_AUTHOR} has started.`, | |
}] | |
} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
- name: Deploy to Kubernetes | |
run: npx @endeavorb2b/rancher2cli dl basecms-service company-update-app ${{ needs.vars.outputs.image }} | |
env: | |
RANCHER_CLUSTERID: ${{ secrets.RANCHER_CLUSTERID_BASECMS }} | |
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }} | |
RANCHER_URL: ${{ secrets.RANCHER_URL }} | |
- uses: 8398a7/action-slack@v3 | |
with: | |
status: custom | |
fields: repo,ref,author,took | |
if: always() | |
custom_payload: | | |
{ | |
attachments: [{ | |
color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning', | |
text: `Deployment of ${process.env.AS_REPO}@${process.env.AS_REF} by ${process.env.AS_AUTHOR} ${{ job.status }} in ${process.env.AS_TOOK}`, | |
}] | |
} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |