Publish Docker Image to GHCR #65
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: Publish Docker Image to GHCR | |
on: workflow_dispatch | |
jobs: | |
build-push: | |
name: Build and Push to GHCR | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Login to GitHub Container registry | |
uses: docker/login-action@v1 | |
env: | |
GITHUB_USER: ${{ github.actor }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
registry: ghcr.io | |
username: $GITHUB_USER | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: downcase REPO | |
run: | | |
echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | |
echo ${REPO} | |
echo ${GITHUB_REPOSITORY} | |
- name: Build and Push | |
env: | |
REGISTRY: ghcr.io | |
run: | | |
docker build -t $REGISTRY/${REPO}:latest -t $REGISTRY/${REPO}:$(date +%s) . | |
docker push $REGISTRY/${REPO} --all-tags |