37 lines
891 B
YAML
37 lines
891 B
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Log in to Gitea Container Registry
|
|
run: |
|
|
echo "${{ secrets.CR_TOKEN }}" | \
|
|
docker login git.stdm.moe -u ${{ github.actor }} --password-stdin
|
|
|
|
- name: Build and push
|
|
run: |
|
|
IMAGE=git.stdm.moe/stardream/streamhall
|
|
REF="${{ github.ref }}"
|
|
|
|
if [[ "$REF" == refs/tags/* ]]; then
|
|
VERSION="${REF#refs/tags/}"
|
|
docker build -t "${IMAGE}:${VERSION}" -t "${IMAGE}:latest" .
|
|
docker push "${IMAGE}:${VERSION}"
|
|
docker push "${IMAGE}:latest"
|
|
else
|
|
docker build -t "${IMAGE}:latest" .
|
|
docker push "${IMAGE}:latest"
|
|
fi
|