mirror of
https://github.com/morbalint/kemkas.git
synced 2026-07-18 03:13:46 +00:00
ci: split repo: make this repo frontend only again
This commit is contained in:
+9
-147
@@ -18,54 +18,22 @@ jobs:
|
||||
- name: Cache NPM packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
key: npm-${{ hashFiles('./Kemkas.Web/frontend/yarn.lock') }}
|
||||
key: npm-${{ hashFiles('./frontend/yarn.lock') }}
|
||||
path: |
|
||||
./Kemkas.Web/frontend/node_modules
|
||||
./frontend/node_modules
|
||||
restore-keys: |
|
||||
npm-${{ hashFiles('./Kemkas.Web/frontend/yarn.lock') }}
|
||||
npm-${{ hashFiles('./frontend/yarn.lock') }}
|
||||
npm-
|
||||
- name: Yarn Install
|
||||
run: |
|
||||
cd ./Kemkas.Web/frontend
|
||||
cd ./frontend
|
||||
yarn install --frozen-lockfiles
|
||||
- name: Yarn Test
|
||||
run: |
|
||||
cd ./Kemkas.Web/frontend
|
||||
cd ./frontend
|
||||
./compile-less.sh
|
||||
yarn build
|
||||
|
||||
docker-build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
- name: Install doctl
|
||||
uses: digitalocean/action-doctl@v2
|
||||
with:
|
||||
token: ${{ secrets.DO_ACCESS_TOKEN }}
|
||||
- name: Log in to DigitalOcean Container Registry with short-lived credentials
|
||||
run: doctl registry login --expiry-seconds 1200
|
||||
- name: Log in to GitHub Container Registry
|
||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
||||
- uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: Kemkas.Web/Dockerfile
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
push: false
|
||||
load: true
|
||||
tags: kemkas/kemkas:edge
|
||||
- name: Tag container image
|
||||
run: |
|
||||
docker tag kemkas/kemkas:edge registry.digitalocean.com/kemkas/kemkas:${GITHUB_SHA::8}
|
||||
docker tag kemkas/kemkas:edge ghcr.io/${{ github.repository_owner }}/kemkas:${GITHUB_SHA::8}
|
||||
- name: Push image to Container Registry
|
||||
run: |
|
||||
docker push registry.digitalocean.com/kemkas/kemkas:${GITHUB_SHA::8}
|
||||
docker push ghcr.io/${{ github.repository_owner }}/kemkas:${GITHUB_SHA::8}
|
||||
|
||||
docker-fe-build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -82,8 +50,8 @@ jobs:
|
||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
||||
- uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./Kemkas.Web/frontend/
|
||||
file: ./Kemkas.Web/frontend/Dockerfile
|
||||
context: ./frontend/
|
||||
file: ./frontend/Dockerfile
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
push: false
|
||||
@@ -92,114 +60,8 @@ jobs:
|
||||
- name: Tag container image
|
||||
run: |
|
||||
docker tag kemkas/kemkas-fe:edge registry.digitalocean.com/kemkas/kemkas-fe:${GITHUB_SHA::8}
|
||||
docker tag kemkas/kemkas-fe:edge ghcr.io/${{ github.repository_owner }}/kemkas-fe:${GITHUB_SHA::8}
|
||||
docker tag kemkas/kemkas-fe:edge ghcr.io/${{ github.repository_owner }}/kemkas-frontend:${GITHUB_SHA::8}
|
||||
- name: Push image to Container Registry
|
||||
run: |
|
||||
docker push registry.digitalocean.com/kemkas/kemkas-fe:${GITHUB_SHA::8}
|
||||
docker push ghcr.io/${{ github.repository_owner }}/kemkas-fe:${GITHUB_SHA::8}
|
||||
|
||||
docker-be-build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
- name: Install doctl
|
||||
uses: digitalocean/action-doctl@v2
|
||||
with:
|
||||
token: ${{ secrets.DO_ACCESS_TOKEN }}
|
||||
- name: Log in to DigitalOcean Container Registry with short-lived credentials
|
||||
run: doctl registry login --expiry-seconds 1200
|
||||
- name: Log in to GitHub Container Registry
|
||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
||||
- uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: Kemkas.Web/Backend.Dockerfile
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
push: false
|
||||
load: true
|
||||
tags: kemkas/kemkas-be:edge
|
||||
- name: Tag container image
|
||||
run: |
|
||||
docker tag kemkas/kemkas-be:edge registry.digitalocean.com/kemkas/kemkas-be:${GITHUB_SHA::8}
|
||||
docker tag kemkas/kemkas-be:edge ghcr.io/${{ github.repository_owner }}/kemkas-be:${GITHUB_SHA::8}
|
||||
- name: Push image to Container Registry
|
||||
run: |
|
||||
docker push registry.digitalocean.com/kemkas/kemkas-be:${GITHUB_SHA::8}
|
||||
docker push ghcr.io/${{ github.repository_owner }}/kemkas-be:${GITHUB_SHA::8}
|
||||
|
||||
docker-composit-build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
needs:
|
||||
- docker-be-build
|
||||
- docker-fe-build
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
- name: Log in to GitHub Container Registry
|
||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
||||
- run: |
|
||||
echo "GITHUB_SHA_SHORT=$(echo ${GITHUB_SHA::8})" >> $GITHUB_ENV
|
||||
- uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: Kemkas.Web/Composite.Dockerfile
|
||||
build-args: |
|
||||
FE_TAG=${{ env.GITHUB_SHA_SHORT }}
|
||||
BE_TAG=${{ env.GITHUB_SHA_SHORT }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
push: false
|
||||
load: true
|
||||
tags: ghcr.io/${{ github.repository_owner }}/kemkas/kemkas-composite:${{ env.GITHUB_SHA_SHORT }}
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- ci-fe
|
||||
- docker-build
|
||||
if: ${{ github.event_name == 'push' || ( github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged ) }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install doctl
|
||||
uses: digitalocean/action-doctl@v2
|
||||
with:
|
||||
token: ${{ secrets.DO_ACCESS_TOKEN }}
|
||||
- name: Log in to DigitalOcean Container Registry with short-lived credentials
|
||||
run: doctl registry login --expiry-seconds 1200
|
||||
- name: Log in to GitHub Container Registry
|
||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
||||
- name: Tag container image with latest tag
|
||||
run: |
|
||||
docker pull ghcr.io/${{ github.repository_owner }}/kemkas:${GITHUB_SHA::8}
|
||||
docker pull registry.digitalocean.com/kemkas/kemkas:${GITHUB_SHA::8}
|
||||
docker tag registry.digitalocean.com/kemkas/kemkas:${GITHUB_SHA::8} registry.digitalocean.com/kemkas/kemkas:latest
|
||||
docker tag ghcr.io/${{ github.repository_owner }}/kemkas:${GITHUB_SHA::8} ghcr.io/${{ github.repository_owner }}/kemkas:latest
|
||||
- name: Push image to Container Registry
|
||||
run: |
|
||||
docker push registry.digitalocean.com/kemkas/kemkas:latest
|
||||
docker push ghcr.io/${{ github.repository_owner }}/kemkas:latest
|
||||
- name: Get container image ID of the images just pushed
|
||||
run: |
|
||||
docker images ghcr.io/${{ github.repository_owner }}/kemkas:${GITHUB_SHA::8} --format "{{.ID}}"
|
||||
export DOCKER_IMAGE_ID=$(docker images ghcr.io/${{ github.repository_owner }}/kemkas:${GITHUB_SHA::8} --format "{{.ID}}")
|
||||
export DOCKER_IMAGE_ID=GHCR-$DOCKER_IMAGE_ID
|
||||
echo "DOCKER_IMAGE_ID=$DOCKER_IMAGE_ID" >> $GITHUB_ENV
|
||||
- uses: mukunku/tag-exists-action@v1.6.0
|
||||
with:
|
||||
tag: ${{ env.DOCKER_IMAGE_ID }}
|
||||
- name: Tag commit with docker image ID
|
||||
if: steps.check-tag.outputs.exists == 'false'
|
||||
uses: actions/github-script@v5
|
||||
with:
|
||||
script: |
|
||||
github.rest.git.createRef({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
ref: "refs/tags/${{ env.DOCKER_IMAGE_ID }}",
|
||||
sha: context.sha
|
||||
})
|
||||
docker push ghcr.io/${{ github.repository_owner }}/kemkas-frontend:${GITHUB_SHA::8}
|
||||
|
||||
Reference in New Issue
Block a user