refactor(build): changes to the way we do release so it builds as well
All checks were successful
Build and Push LST Docker Image / docker (push) Successful in 1m21s

This commit is contained in:
2026-04-03 11:54:41 -05:00
parent c4fd74fc93
commit 7d55c5f431
2 changed files with 52 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
name: Create Gitea Release
name: Release and Build Image
on:
push:
@@ -18,9 +18,14 @@ jobs:
run: |
TAG="${GITHUB_REF_NAME:-${GITHUB_REF##refs/tags/}}"
VERSION="${TAG#v}"
IMAGE_REGISTRY="${{ gitea.server_url }}"
IMAGE_REGISTRY="${IMAGE_REGISTRY#http://}"
IMAGE_REGISTRY="${IMAGE_REGISTRY#https://}"
IMAGE_NAME="${IMAGE_REGISTRY}/${{ gitea.repository }}"
echo "TAG=$TAG" >> "$GITHUB_ENV"
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
echo "IMAGE_NAME=$IMAGE_NAME" >> "$GITHUB_ENV"
if [[ "$TAG" == *-* ]]; then
echo "PRERELEASE=true" >> "$GITHUB_ENV"
@@ -31,7 +36,7 @@ jobs:
- name: Extract matching CHANGELOG section
shell: bash
run: |
python <<'PY'
python3 - <<'PY'
import os
import re
from pathlib import Path
@@ -46,10 +51,6 @@ jobs:
text = changelog_path.read_text(encoding="utf-8")
# Matches headings like:
# ## 1.2.3
# ## 1.2.3-alpha.0
# ## [1.2.3]
pattern = re.compile(
rf"^##\s+\[?{re.escape(version)}\]?(?:\s*-.*)?\n(.*?)(?=^##\s|\Z)",
re.MULTILINE | re.DOTALL,
@@ -67,6 +68,42 @@ jobs:
Path("release_body.md").write_text(body + "\n", encoding="utf-8")
PY
- name: Log in to Gitea container registry
shell: bash
env:
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
run: |
echo "$REGISTRY_TOKEN" | docker login "${IMAGE_NAME%%/*}" -u "$REGISTRY_USERNAME" --password-stdin
- name: Build Docker image
shell: bash
run: |
docker build \
-t "$IMAGE_NAME:$TAG" \
-t "$IMAGE_NAME:latest" \
.
- name: Push version tag
shell: bash
run: |
docker push "$IMAGE_NAME:$TAG"
- name: Push latest tag
if: ${{ !contains(env.TAG, '-') }}
shell: bash
run: |
docker push "$IMAGE_NAME:latest"
- name: Push prerelease channel tag
if: ${{ contains(env.TAG, '-') }}
shell: bash
run: |
CHANNEL="${TAG#*-}"
CHANNEL="${CHANNEL%%.*}"
docker tag "$IMAGE_NAME:$TAG" "$IMAGE_NAME:$CHANNEL"
docker push "$IMAGE_NAME:$CHANNEL"
- name: Create Gitea release
env:
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
@@ -74,10 +111,11 @@ jobs:
GITEA_REPOSITORY: ${{ gitea.repository }}
shell: bash
run: |
python <<'PY'
python3 - <<'PY'
import json
import os
import urllib.request
import urllib.error
tag = os.environ["TAG"]
prerelease = os.environ["PRERELEASE"].lower() == "true"
@@ -88,6 +126,9 @@ jobs:
with open("release_body.md", "r", encoding="utf-8") as f:
body = f.read()
image_name = os.environ["IMAGE_NAME"]
body = body.rstrip() + f"\n\n### Container Image\n\n- `{image_name}:{tag}`\n"
url = f"{server_url}/api/v1/repos/{repo}/releases"
payload = {
"tag_name": tag,

View File

@@ -74,7 +74,7 @@ stage the change log file
git commit -m "chore(release): version packages"
git tag v0.0.1-alpha.0 this will be the new version
git tag v0.0.1-alpha.0 change this to the same version thats in the pkg.json
then push it
@@ -111,3 +111,4 @@ Release flow
7. git tag vX.X.X
8. git push
9. git push --tags