Adding on github actions
This commit is contained in:
5
.github/workflows/build.yml
vendored
5
.github/workflows/build.yml
vendored
@@ -13,7 +13,7 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: ghcr.io
|
||||||
IMAGE_NAME: ${{ github.repository.lowercase }}
|
# IMAGE_NAME: ${{ github.repository }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -49,13 +49,14 @@ jobs:
|
|||||||
# labels: ${{ steps.meta.outputs.labels }}
|
# labels: ${{ steps.meta.outputs.labels }}
|
||||||
- name: Build the Docker image
|
- name: Build the Docker image
|
||||||
run: |
|
run: |
|
||||||
|
IMAGE_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
|
||||||
if [[ "$GITHUB_REF" =~ ^refs/tags.* ]]; then
|
if [[ "$GITHUB_REF" =~ ^refs/tags.* ]]; then
|
||||||
VERSION=$GITHUB_REF_NAME
|
VERSION=$GITHUB_REF_NAME
|
||||||
else
|
else
|
||||||
VERSION=$(echo "${GITHUB_REF_NAME}" | sed 's|/|-|g')
|
VERSION=$(echo "${GITHUB_REF_NAME}" | sed 's|/|-|g')
|
||||||
fi
|
fi
|
||||||
podman build . --file Dockerfile --tag "$REGISTRY/$IMAGE_NAME:$VERSION"
|
podman build . --file Dockerfile --tag "$REGISTRY/$IMAGE_NAME:$VERSION"
|
||||||
# echo $REG_TOKEN | podman login ghcr.io -u ${GITHUB_ACTOR} --password-stdin
|
# echo $REG_TOKEN | podman login ${$REGISTRY} -u ${GITHUB_ACTOR} --password-stdin
|
||||||
podman push "$REGISTRY/$IMAGE_NAME:$VERSION"
|
podman push "$REGISTRY/$IMAGE_NAME:$VERSION"
|
||||||
if [[ "$GITHUB_REF" =~ ^refs/tags.* ]]; then
|
if [[ "$GITHUB_REF" =~ ^refs/tags.* ]]; then
|
||||||
podman tag "$REGISTRY/$IMAGE_NAME:$VERSION" "$IMAGE_NAME:latest"
|
podman tag "$REGISTRY/$IMAGE_NAME:$VERSION" "$IMAGE_NAME:latest"
|
||||||
|
|||||||
Reference in New Issue
Block a user