51 lines
1.2 KiB
YAML
51 lines
1.2 KiB
YAML
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
name: Build container
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- uses: https://gitea.com/actions/checkout@v4
|
|
|
|
- name: Fetch tags from main branch
|
|
id: version
|
|
run: |
|
|
git fetch origin main --tags
|
|
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
|
|
# remove the 'v' prefix from the tag name
|
|
echo "BUILD_NAME=${LATEST_TAG//v}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Output the version that is being used
|
|
run: |
|
|
echo "Building for version ${{ steps.version.outputs.BUILD_NAME }}"
|
|
|
|
|
|
- name: Login to Docker Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.kluster.moll.re
|
|
username: ${{ gitea.repository_owner }}
|
|
password: ${{ secrets.PACKAGE_REGISTRY_ACCESS }}
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
# use the current commit SHA as the tag
|
|
tags: git.kluster.moll.re/remoll/journal-bot:${{ steps.version.outputs.BUILD_NAME }}-${{ gitea.run_number }}
|
|
push: true
|