chore: fix unsupported subdirectories #2
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: CD Prod Deploy | ||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
concurrency: | ||
group: ${{ github.repository }}-deployment | ||
cancel-in-progress: true | ||
jobs: | ||
FrontendCI: | ||
uses: ./.github/workflows/ci/ci-frontend.yml | ||
BackendCI: | ||
uses: ./.github/workflows/ci/ci-backend.yml | ||
CreateVersion: | ||
if: github.event_name == 'workflow_dispatch' | ||
needs: [ BackendCI, FrontendCI ] | ||
runs-on: ubuntu-latest | ||
outputs: | ||
new_tag: ${{ steps.tag.outputs.new_tag }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Create version tag | ||
uses: anothrNick/[email protected] | ||
id: tag | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
WITH_V: false | ||
DRY_RUN: true | ||
Dockerize: | ||
strategy: | ||
matrix: | ||
app: [ frontend, backend ] | ||
needs: [ CreateVersion ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login Docker Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and Push Docker Image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./${{ matrix.app }} | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}/${{ matrix.app }}:${{ needs.CreateVersion.outputs.new_tag }} | ||
cache-from: type=gha,scope=buildkit-${{ matrix.app }} | ||
cache-to: type=gha,mode=max,scope=buildkit-${{ matrix.app }} | ||
Deploy: | ||
needs: [ Dockerize ] | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: prod | ||
url: https://k8splay.xyz | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
- name: Save version tag | ||
uses: anothrNick/[email protected] | ||
id: tag | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
WITH_V: false | ||
DRY_RUN: false | ||
- name: Install Kubectl | ||
uses: Azure/setup-kubectl@v4 | ||
- name: Configure Kubectl | ||
env: | ||
K8S_CONFIG: ${{ secrets.K8S_CONFIG }} | ||
run: | | ||
mkdir -p $HOME/.kube | ||
echo "${K8S_CONFIG}" | base64 --decode > $HOME/.kube/config | ||
shell: bash | ||
- name: Install App with Helm | ||
run: | | ||
helm upgrade prod ./.k8s/app \ | ||
--namespace prod \ | ||
--set ingress.domain=k8splay.xyz \ | ||
--set app.image.tag=${{ steps.tag.outputs.new_tag }} \ | ||
--set keycloak.realm=production \ | ||
--set keycloak.client.secret=${{ secrets.KEYCLOAK_BACKEND_SECRET }} \ | ||
--wait \ | ||
--atomic \ | ||
--timeout 180s | ||
shell: bash |