Build docker #2
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: Build docker | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: "Name of tag, e.g. 1.0" | |
required: true | |
type: string | |
workflow_call: | |
inputs: | |
tag: | |
description: "Name of tag, e.g. 1.0" | |
required: true | |
type: string | |
permissions: | |
packages: write | |
env: | |
IMAGE_NAME: ghcr.io/istudyatuni/kotync | |
IMAGE_TAG: ${{ inputs.tag }} | |
ORIGINAL_TAG: ${{ inputs.tag }}-original | |
MYSQL_TAG: ${{ inputs.tag }}-mysql | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build docker | |
run: | | |
echo $IMAGE_TAG > .version | |
docker build . --tag $IMAGE_NAME:$IMAGE_TAG | |
docker build . --tag $IMAGE_NAME:$ORIGINAL_TAG --build-arg kind=original | |
docker build . --tag $IMAGE_NAME:$MYSQL_TAG --build-arg kind=mysql | |
- name: Login to ghcr | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push docker | |
run: | | |
docker push $IMAGE_NAME:$ORIGINAL_TAG | |
docker push $IMAGE_NAME:$MYSQL_TAG | |
docker push $IMAGE_NAME:$IMAGE_TAG |