Skip to content

refactor: remove hardcoded base URL for EVCC optimization request #16

refactor: remove hardcoded base URL for EVCC optimization request

refactor: remove hardcoded base URL for EVCC optimization request #16

name: feature - build image and push
# This workflow builds and pushes a Docker image to GitHub Container Registry.
# It is triggered on pushes to branches other than "main" and "develop", and can also be triggered manually.
# The image is tagged with the branch name of the push event.
# The workflow uses the GITHUB_TOKEN secret for authentication with GitHub Container Registry.
on:
push:
branches-ignore:
- "main"
- "develop"
workflow_dispatch: # allows manual triggering of the workflow
jobs:
pytest:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
- name: Run unit and regression tests
run: python -m pytest -v tests/
build_image:
needs: pytest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Convert repository owner to lowercase
run: echo "owner=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Build image
run: docker build -t ghcr.io/${{ env.owner }}/eos_connect:feature .
- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Tag image with develop version
run: docker tag ghcr.io/${{ env.owner }}/eos_connect:feature ghcr.io/${{ env.owner }}/eos_connect:feature_dev_${{ github.ref_name }}
- name: Push Docker image to GitHub Container Registry
run: |
docker push ghcr.io/${{ env.owner }}/eos_connect:feature_dev_${{ github.ref_name }}