All checks were successful
Docker Build and Push / build-and-push (push) Successful in 1m28s
38 lines
No EOL
1.1 KiB
YAML
38 lines
No EOL
1.1 KiB
YAML
name: Docker Build and Push
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- dev
|
|
jobs:
|
|
build-and-push:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Login to Forgejo
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.jan-ole.cloud
|
|
username: ${{ secrets.DOCKER_USER }}
|
|
password: ${{ secrets.DOCKER_TOKEN }}
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Build and push Docker image
|
|
shell: bash
|
|
env:
|
|
DOCKER_IMAGE_NAME: tibber-influx
|
|
run: |
|
|
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
|
|
DOCKER_TAG="latest"
|
|
elif [ "${{ github.ref }}" == "refs/heads/dev" ]; then
|
|
DOCKER_TAG="development"
|
|
else
|
|
DOCKER_TAG="other"
|
|
fi
|
|
docker build -t $DOCKER_IMAGE_NAME .
|
|
docker tag $DOCKER_IMAGE_NAME:latest git.jan-ole.cloud/${{ secrets.DOCKER_USER }}/$DOCKER_IMAGE_NAME:$DOCKER_TAG
|
|
docker push git.jan-ole.cloud/${{ secrets.DOCKER_USER }}/$DOCKER_IMAGE_NAME:$DOCKER_TAG |