Skip to content

Merge pull request #271 from makeopensource/126-cateogry-score #10

Merge pull request #271 from makeopensource/126-cateogry-score

Merge pull request #271 from makeopensource/126-cateogry-score #10

Workflow file for this run

# Builds DevU api
name: Build DevU api
on:
push:
paths:
- 'devU-api/**'
branches:
- develop # add more branches as needed
jobs:
build-api-docker:
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
packages: write # to be able to publish docker image packages
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Convert image name to lowercase
run: |
original_string=${{ github.repository }}
echo "repo_url=$(echo $original_string | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Get Branch Name
id: get_branch
run: echo "::set-output name=branch_name::${GITHUB_REF#refs/heads/}"
- name: build api docker
run: |
IMAGE_NAME=ghcr.io/${{ env.repo_url }}/api:${{ steps.get_branch.outputs.branch_name }}
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITHUB_ENV
docker build . -f api.Dockerfile -t $IMAGE_NAME
docker push $IMAGE_NAME