Feat/zbornica #1039
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: Build and deploy (pull request) | |
on: | |
pull_request: | |
types: [synchronize, reopened, labeled] | |
env: | |
RELEASE_NAME: website-pr-${{ github.event.pull_request.number }} | |
CHART_VALUES_FILE: .helm/values.pr.yml | |
DEPLOY_NAMESPACE: doctors-pr | |
DEPLOY_ENV: pr-${{ github.event.pull_request.number }} | |
DEPLOY_URL: https://pr-${{ github.event.pull_request.number }}.zdravniki.sledilnik.org | |
IMAGE_TAG: pr-${{ github.event.pull_request.number }} | |
INGRESS_RULE: Host(`pr-${{ github.event.pull_request.number }}.zdravniki.sledilnik.org`) | |
jobs: | |
build: | |
if: contains(github.event.pull_request.labels.*.name, 'deploy-preview') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Build and push docker container image | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
context: . | |
file: ./Dockerfile | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/website:${{ env.IMAGE_TAG}} | |
build-args: | | |
BUILD_MODE=staging | |
deploy: | |
runs-on: ubuntu-latest | |
if: contains(github.event.pull_request.labels.*.name, 'deploy-preview') | |
needs: build | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Deploy | |
uses: sledilnik/[email protected] | |
with: | |
chartName: sledilnik/website | |
chartVersion: '1.0.0' | |
kubeconfig: '${{ secrets.KUBECONFIG }}' |