Skip to content

Merge pull request #428 from fujaba/chore/update #104

Merge pull request #428 from fujaba/chore/update

Merge pull request #428 from fujaba/chore/update #104

name: Deploy Backend
on:
push:
branches:
- master
tags:
- v*
# TODO the backend needs to be deployed every time because it contains the version number
# paths:
# - 'backend/**'
concurrency:
group: deploy-backend
cancel-in-progress: true
jobs:
backend:
name: Backend
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # for git describe
- name: Set Deployment Options
id: deployment
run: ./.github/workflows/deploy.sh
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: backend/
push: true
tags: ${{ secrets.DOCKER_REGISTRY }}/fulib/fulib.org-backend:${{ steps.deployment.outputs.tag }}
build-args: |
VERSION=${{ steps.deployment.outputs.version }}
cache-to: type=gha,mode=max
cache-from: type=gha
- name: Deploy to Rancher
uses: sekassel-research/[email protected]
with:
rancher_url: ${{ secrets.RANCHER_URL }}
rancher_token: ${{ secrets.RANCHER_TOKEN }}
cluster_id: ${{ secrets.RANCHER_CLUSTER }}
project_id: ${{ secrets.RANCHER_PROJECT }}
namespace: ${{ secrets.NAMESPACE }}
deployment: fulib-backend
docker_image: ${{ secrets.DOCKER_REGISTRY }}/fulib/fulib.org-backend:${{ steps.deployment.outputs.tag }}