Skip to content

Workflow file for this run

name: 📤publish-dogu
run-name: 📤publish-dogu-${{ github.event.inputs.version && github.event.inputs.version || 'rc' }}@${{ github.ref_name }}
on:
workflow_dispatch:
inputs:
rc_check:
type: boolean
description: RC version (❗ if checked, version must be empty.)
version:
type: string
description: 'Dogu image version (example: 1.0.0 ❗ if not empty, RC must be unchecked.)'
default: ''
jobs:
input-validation:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.input-validation.outputs.tag }}
temp_repo: dogutechio/dogu-temp
upload_repo: ${{ steps.input-validation.outputs.upload_repo }}
steps:
- id: input-validation
name: input validation
run: |
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
echo "rc_check is ${{ github.event.inputs.rc_check }}"
echo "version is ${{ github.event.inputs.version }}"
rc_check=${{ github.event.inputs.rc_check }}
version=${{ github.event.inputs.version }}
if [ "$rc_check" = "true" ] && [ -n "$version" ]; then
echo -e "${RED}Skipping because rc_check is true and version is not empty${NC}"
exit 1
elif [ "$rc_check" = "false" ] && [ -z "$version" ]; then
echo -e "${RED}Skipping because rc_check is false and version is empty${NC}"
exit 1
else
if [ "$rc_check" = "true" ]; then
tag=rc
upload_repo=dogutechio/dogu-rc
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
echo "upload_repo=${upload_repo}" >> "$GITHUB_OUTPUT"
echo -e "${GREEN} dogu upload-image-repo is ${upload_repo}${NC}"
echo -e "${GREEN} dogu upload-image-tag is ${tag}${NC}"
else
tag=${version}
upload_repo=dogutechio/dogu
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
echo "upload_repo=${upload_repo}" >> "$GITHUB_OUTPUT"
echo -e "${GREEN} dogu upload-image-repo is ${upload_repo}${NC}"
echo -e "${GREEN} dogu upload-image-tag is ${tag}${NC}"
fi
echo -e "${GREEN} input validation successful${NC}"
fi
publish-amd64:
needs: input-validation
runs-on: ubuntu-latest
steps:
- name: docker init
run: docker system prune --volumes -a -f
- name: Checkout
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./dockerfile
push: true
target: dogu-console
platforms: linux/amd64
no-cache: true
tags: |
${{needs.input-validation.outputs.temp_repo}}:${{needs.input-validation.outputs.tag}}-amd64
publish-arm64:
needs: input-validation
runs-on: dogu-build-arm
steps:
- name: docker init
run: docker system prune --volumes -a -f
- name: Checkout
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./dockerfile
push: true
target: dogu-console
platforms: linux/arm64
no-cache: true
tags: |
${{needs.input-validation.outputs.temp_repo}}:${{needs.input-validation.outputs.tag}}-arm64
publish-menifest:
needs: [input-validation, publish-arm64, publish-amd64]
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.input-validation.outputs.tag }}
temp_repo: ${{ steps.input-validation.outputs.temp_repo }}
upload_repo: ${{ steps.input-validation.outputs.upload_repo }}
steps:
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Create and push manifest images
run: |
docker manifest create ${{needs.input-validation.outputs.upload_repo}}:${{needs.input-validation.outputs.tag}} \
${{needs.input-validation.outputs.temp_repo}}:${{needs.input-validation.outputs.tag}}-amd64 \
${{needs.input-validation.outputs.temp_repo}}:${{needs.input-validation.outputs.tag}}-arm64
docker manifest push ${{needs.input-validation.outputs.upload_repo}}:${{needs.input-validation.outputs.tag}}
send-slack:
runs-on: ubuntu-latest
needs: publish-menifest
if: ${{ always() }}
steps:
- name: Send Slack
uses: dogu-team/[email protected]
with:
template: 'CD'
slack-channel-id: 'C057ML9UH34'
result-status: ${{ needs.publish-menifest.result }}
ignore-notify: false
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}