Skip to content

Remove path from action and add context on build #5

Remove path from action and add context on build

Remove path from action and add context on build #5

Workflow file for this run

name: Build
on:
push:
branches:
- master
- develop
tags:
- '*'
pull_request:
types: [opened, synchronize, reopened]
jobs:
# sonarcloud:
# name: SonarCloud
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
# - name: SonarCloud Scan
# uses: SonarSource/sonarcloud-github-action@master
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
build:
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: "registry.sireto.io"
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
-
name: Build and push
uses: docker/build-push-action@v4
with:
context: ./delta-pdf-api/
push: true
tags: |
registry.sireto.io/deltalender/delta-pdf-api:${{ github.sha }}
${{ format('registry.sireto.io/deltalender/delta-pdf-api:{0}', github.ref_name == 'master' && 'latest' || github.ref_name ) }}
deploy:
needs: [build]
runs-on: ubuntu-latest
steps:
-
name: Executing remote ssh commands using ssh key and deploying
uses: appleboy/[email protected]
with:
host: ${{ secrets.SIRETO_BASTION_HOST }}
username: githubci
key: ${{ secrets.SIRETO_BASTION_SSH_KEY }}
port: ${{ secrets.SIRETO_BASTION_PORT }}
script: |
if [ ${{ github.ref_type }} == 'master' ]; then
docker --host=${{ secrets.PROD_DEPLOYMENT_HOST }} service update --image=registry.sireto.io/deltalender/delta-pdf-api:${{ github.ref_name }} delta_sign_api
elif [ ${{ github.ref_name }} == 'develop' ]; then
docker --host=${{ secrets.DEV_DEPLOYMENT_HOST }} service update --image=registry.sireto.io/deltalender/delta-pdf-api:${{ github.sha }} delta_sign_dev_api
else
echo "Deployment skipped for branch ${{ github.ref }}"
fi