mirror of
https://github.com/morbalint/kemkas.git
synced 2026-07-17 19:03:46 +00:00
ci: parallelize docker build with ci test checks
This commit is contained in:
+33
-20
@@ -28,8 +28,6 @@ jobs:
|
|||||||
|
|
||||||
docker-build:
|
docker-build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
|
||||||
- ci-fe
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
@@ -46,23 +44,38 @@ jobs:
|
|||||||
- name: Tag container image
|
- name: Tag container image
|
||||||
run: |
|
run: |
|
||||||
docker tag kemkas:${GITHUB_SHA::8} registry.digitalocean.com/kemkas/kemkas:${GITHUB_SHA::8}
|
docker tag kemkas:${GITHUB_SHA::8} registry.digitalocean.com/kemkas/kemkas:${GITHUB_SHA::8}
|
||||||
- name: Tag container image with latest tag
|
|
||||||
if: ${{ github.event_name == 'push' || ( github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged ) }}
|
|
||||||
run: |
|
|
||||||
docker tag kemkas:${GITHUB_SHA::8} registry.digitalocean.com/kemkas/kemkas:latest
|
|
||||||
- name: Push image to Container Registry
|
- name: Push image to Container Registry
|
||||||
run: |
|
run: |
|
||||||
docker push --all-tags registry.digitalocean.com/kemkas/kemkas
|
docker push registry.digitalocean.com/kemkas/kemkas:${GITHUB_SHA::8}
|
||||||
- name: Get container image ID of the images just pushed
|
|
||||||
if: ${{ github.event_name == 'push' || ( github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged ) }}
|
deploy:
|
||||||
run: |
|
runs-on: ubuntu-latest
|
||||||
docker images registry.digitalocean.com/kemkas/kemkas:${GITHUB_SHA::8} --format "{{.ID}}"
|
needs:
|
||||||
export DOCKER_IMAGE_ID=$(docker images registry.digitalocean.com/kemkas/kemkas:${GITHUB_SHA::8} --format "{{.ID}}")
|
- ci-fe
|
||||||
export DOCKER_IMAGE_ID=DO-$DOCKER_IMAGE_ID
|
- docker-build
|
||||||
echo "DOCKER_IMAGE_ID=$DOCKER_IMAGE_ID" >> $GITHUB_ENV
|
if: ${{ github.event_name == 'push' || ( github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged ) }}
|
||||||
- name: Tag commit
|
steps:
|
||||||
if: ${{ github.event_name == 'push' || ( github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged ) }}
|
- uses: actions/checkout@v3
|
||||||
uses: tvdias/github-tagger@v0.0.1
|
- name: Install doctl
|
||||||
with:
|
uses: digitalocean/action-doctl@v2
|
||||||
repo-token: "${{ github.token }}"
|
with:
|
||||||
tag: "${{ env.DOCKER_IMAGE_ID }}"
|
token: ${{ secrets.DO_ACCESS_TOKEN }}
|
||||||
|
- name: Log in to DigitalOcean Container Registry with short-lived credentials
|
||||||
|
run: doctl registry login --expiry-seconds 1200
|
||||||
|
- name: Tag container image with latest tag
|
||||||
|
run: |
|
||||||
|
docker tag registry.digitalocean.com/kemkas/kemkas:${GITHUB_SHA::8} registry.digitalocean.com/kemkas/kemkas:latest
|
||||||
|
- name: Push image to Container Registry
|
||||||
|
run: |
|
||||||
|
docker push registry.digitalocean.com/kemkas/kemkas:latest
|
||||||
|
- name: Get container image ID of the images just pushed
|
||||||
|
run: |
|
||||||
|
docker images registry.digitalocean.com/kemkas/kemkas:${GITHUB_SHA::8} --format "{{.ID}}"
|
||||||
|
export DOCKER_IMAGE_ID=$(docker images registry.digitalocean.com/kemkas/kemkas:${GITHUB_SHA::8} --format "{{.ID}}")
|
||||||
|
export DOCKER_IMAGE_ID=DO-$DOCKER_IMAGE_ID
|
||||||
|
echo "DOCKER_IMAGE_ID=$DOCKER_IMAGE_ID" >> $GITHUB_ENV
|
||||||
|
- name: Tag commit
|
||||||
|
uses: tvdias/github-tagger@v0.0.1
|
||||||
|
with:
|
||||||
|
repo-token: "${{ github.token }}"
|
||||||
|
tag: "${{ env.DOCKER_IMAGE_ID }}"
|
||||||
Reference in New Issue
Block a user