Add .github/workflows/build2
Some checks failed
Build and Publish TVJ EPG Image / build (push) Failing after 1s
Some checks failed
Build and Publish TVJ EPG Image / build (push) Failing after 1s
This commit is contained in:
73
.github/workflows/build2
vendored
Normal file
73
.github/workflows/build2
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
name: Build and Publish TVJ EPG Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Podman
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y podman
|
||||
|
||||
- name: Read version
|
||||
id: version
|
||||
run: |
|
||||
VERSION="$(cat VERSION | tr -d ' \n')"
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
# ----------------------------
|
||||
# Login to your registry
|
||||
# ----------------------------
|
||||
- name: Registry login
|
||||
env:
|
||||
REGISTRY: ${{ vars.REGISTRY }} # e.g. registry.example.com OR ghcr.io
|
||||
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
||||
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
run: |
|
||||
echo "$REGISTRY_TOKEN" | podman login "$REGISTRY" \
|
||||
-u "$REGISTRY_USER" \
|
||||
--password-stdin
|
||||
|
||||
# ----------------------------
|
||||
# Build & tag
|
||||
# ----------------------------
|
||||
- name: Build image (multi-tag)
|
||||
env:
|
||||
REGISTRY: ${{ vars.REGISTRY }} # e.g. registry.example.com OR ghcr.io
|
||||
IMAGE: ${{ vars.IMAGE }} # e.g. lyncolnmd/tvj-epg (no registry prefix)
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
run: |
|
||||
SHORT_SHA="${GITHUB_SHA::7}"
|
||||
FULL_IMAGE="$REGISTRY/$IMAGE"
|
||||
|
||||
podman build \
|
||||
-f Containerfile \
|
||||
-t "$FULL_IMAGE:latest" \
|
||||
-t "$FULL_IMAGE:v$VERSION" \
|
||||
-t "$FULL_IMAGE:sha-$SHORT_SHA" \
|
||||
.
|
||||
|
||||
# ----------------------------
|
||||
# Push
|
||||
# ----------------------------
|
||||
- name: Push all tags
|
||||
env:
|
||||
REGISTRY: ${{ vars.REGISTRY }}
|
||||
IMAGE: ${{ vars.IMAGE }}
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
run: |
|
||||
SHORT_SHA="${GITHUB_SHA::7}"
|
||||
FULL_IMAGE="$REGISTRY/$IMAGE"
|
||||
|
||||
podman push "$FULL_IMAGE:latest"
|
||||
podman push "$FULL_IMAGE:v$VERSION"
|
||||
podman push "$FULL_IMAGE:sha-$SHORT_SHA"
|
||||
Reference in New Issue
Block a user