Skip to content

Added docker login

Added docker login #5

# This is a basic workflow to help you get started with Actions
name: CI
on:
push:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set variable
run: |
if [ ${{ github.ref_type }} = 'branch' ]; then
if [ ${{ github.ref_name }} = 'main' ]; then
echo "main"
echo "BUILD_TYPE=main" >> $GITHUB_ENV
else
echo "branch"
echo "BUILD_TYPE=branch" >> $GITHUB_ENV
fi
elif [ ${{ github.ref_type }} = 'tag' ]; then
echo "tag"
echo "BUILD_TYPE=tag" >> $GITHUB_ENV
fi
shell: bash
- name: Read exported variable
run: |
echo "OUTPUT: ${{ steps.check.test-env.test }}"
- name: github.ref_type
run: echo ${{github.ref_type}}
- name: github.ref_name
run: echo ${{github.ref_name}}
- name: github.ref
run: echo ${{github.ref}}
- name: env.BUILD_TYPE
run: echo ${{env.BUILD_TYPE}}
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker build branch
run: make docker
if: ${{ env.BUILD_TYPE == 'branch' }}
- name: Docker build main
run: make docker ARGS="-t latest"
if: ${{ env.BUILD_TYPE == 'main' }}
- name: Docker build tag
run: make docker ARGS="-t ${{github.ref_name}}"
if: ${{ env.BUILD_TYPE == 'tag' }}