This repository has been archived by the owner on Apr 19, 2024. It is now read-only.
Docker Image CI #233
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: Docker Image CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/tubekit | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: create tag | |
run: | | |
SHA=${{ github.sha }} | |
TAG=${IMAGE}:$(TZ=UTC-9 date '+%Y%m')-${SHA:0:7} | |
if [ "${{ github.ref }}" == "refs/heads/main" ]; then | |
TAG="${IMAGE}:latest" | |
fi | |
echo "TAG=$TAG" >> $GITHUB_ENV | |
echo TAG $TAG | |
- name: login to dockerhub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: build docker image | |
run: | | |
docker build . -t ${{ env.TAG }} | |
- name: push image | |
run: | | |
docker push ${{ env.TAG }} |