Skip to content

Fix a ghcr issue

Fix a ghcr issue #71

Workflow file for this run

name: Merged to Master
on:
push:
branches:
- master
- deploy-k8s
jobs:
# detect-changes:
# runs-on: ubuntu-latest
# outputs:
# api: ${{ steps.filter.outputs.api }}
# website: ${{ steps.filter.outputs.website }}
# keycloak: ${{ steps.filter.outputs.keycloak }}
# steps:
# - uses: actions/checkout@v3
# - uses: dorny/paths-filter@v2
# id: filter
# with:
# filters: |
# api:
# - apps/api/**
# website:
# - apps/website/**
# keycloak:
# - apps/keycloak/**
# test-api:
# runs-on: ubuntu-latest
# needs: detect-changes
# if: ${{ needs.detect-changes.outputs.api == 'true' }}
# defaults:
# run:
# working-directory: apps/api
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-java@v3
# with:
# distribution: temurin
# java-version: 19
# - name: Cache SonarCloud packages
# uses: actions/cache@v3
# with:
# path: ~/.sonar/cache
# key: ${{ runner.os }}-sonarcloud
# - name: Cache Gradle packages
# uses: actions/cache@v3
# with:
# path: /home/runner/.gradle
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
# restore-keys: ${{ runner.os }}-gradle
# - run: ./gradlew test jacocoTestReport sonar
# env:
# GITHUB_TOKEN: ${{ github.token }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# build-api-image:
# runs-on: ubuntu-latest
# needs: test-api
# steps:
# - uses: actions/checkout@v3
# - uses: docker/setup-buildx-action@v1
# - uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GH_PACKAGES_TOKEN }}
# - uses: docker/build-push-action@v3
# with:
# push: true
# tags: |
# ghcr.io/nikitades/carres-api:latest
# ghcr.io/nikitades/carres-api:${{ github.sha }}
# cache-from: type=gha
# cache-to: type=gha,mode=max
# context: apps/api
# build-website-image:
# runs-on: ubuntu-latest
# needs: detect-changes
# if: ${{ needs.detect-changes.outputs.website == 'true' }}
# defaults:
# run:
# working-directory: apps/website
# steps:
# - uses: actions/checkout@v3
# - uses: docker/setup-buildx-action@v1
# - uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GH_PACKAGES_TOKEN }}
# - uses: docker/build-push-action@v3
# with:
# push: true
# tags: |
# ghcr.io/nikitades/carres-website:latest
# ghcr.io/nikitades/carres-website:${{ github.sha }}
# cache-from: type=gha
# cache-to: type=gha,mode=max
# context: apps/website
# build-keycloak-image:
# runs-on: ubuntu-latest
# needs: detect-changes
# if: ${{ needs.detect-changes.outputs.keycloak == 'true' }}
# defaults:
# run:
# working-directory: apps/website
# steps:
# - uses: actions/checkout@v3
# - uses: docker/setup-buildx-action@v1
# - uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GH_PACKAGES_TOKEN }}
# - uses: docker/build-push-action@v3
# with:
# push: true
# tags: |
# ghcr.io/nikitades/carres-keycloak:latest
# ghcr.io/nikitades/carres-keycloak:${{ github.sha }}
# cache-from: type=gha
# cache-to: type=gha,mode=max
# context: apps/keycloak
deploy:
name: Deploy
runs-on: ubuntu-latest
# needs: [build-api-image, build-website-image, build-keycloak-image]
# if: ${{ always() && needs.build-api-image.result != 'failure' && needs.build-website-image.result != 'failure' && needs.build-keycloak-image.result != 'failure' && (needs.build-api-image.result == 'success' || needs.build-website-image.result == 'success' || needs.build-keycloak-image.result == 'success') }}
steps:
- name: Set the Kubernetes context
uses: azure/k8s-set-context@v2
with:
method: service-account
k8s-url: ${{ secrets.KUBERNETES_SERVER_URL }}
k8s-secret: ${{ secrets.KUBERNETES_SECRET }}
- uses: actions/checkout@v3
- uses: azure/k8s-deploy@v1
with:
namespace: carres
manifests: .k8s/prod/*.yaml
images: |
ghcr.io/nikitades/carres-api:${{ github.sha }}
ghcr.io/nikitades/carres-website:${{ github.sha }}
ghcr.io/nikitades/carres-keycloak:${{ github.sha }}