Skip to content

actually push this time #5

actually push this time

actually push this time #5

Workflow file for this run

name: Build
on: [push]
jobs:
build:
name: Docker Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare
id: prepare
run: |
IMAGE_NAME=yatb
GIT_REPO='https://github.com/${{ github.repository }}'
DOCKER_USER=`echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]'`
DOCKER_IMAGE=ghcr.io/$DOCKER_USER/$IMAGE_NAME
VERSION=`git rev-parse --short HEAD`
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
echo "git_repo=${GIT_REPO}" >> $GITHUB_OUTPUT
echo "docker_user=${DOCKER_USER}" >> $GITHUB_OUTPUT
echo "docker_image=${DOCKER_IMAGE}" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ steps.prepare.outputs.docker_user }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ (github.ref == 'refs/heads/main') || (contains(github.ref, 'refs/tags/') == true) }}
tags: |
${{ steps.prepare.outputs.docker_image }}:latest
${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
build-args: |
GIT_VERSION=${{ steps.prepare.outputs.version }}
GIT_REPO=${{ steps.prepare.outputs.git_repo }}