Skip to content

Publish Docker image #76

Publish Docker image

Publish Docker image #76

name: Publish Docker image
on:
push:
branches:
- main
release:
types: [published]
workflow_dispatch:
schedule:
- cron: "0 1 * * 6"
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Current Date
id: date
run: echo "::set-output name=today::$(date +'%Y-%m-%d')"
- name: PrepareReg Names
id: read-docker-image-identifiers
run: |
repository=${{ github.repository }}
echo IMAGE_NAME_VERSION=$(echo channinghe/${repository##*/}:${{ steps.date.outputs.today }} ) >> $GITHUB_ENV
#echo IMAGE_NAME_LATEST=$(echo $channinghe/${repository##*/}:${{ steps.date.outputs.today }} ) >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v2 # docker build & push
with:
context: .
push: true
tags: |
${{ env.IMAGE_NAME_VERSION }}
channinghe/code-server:latest