Skip to content

Update build-frontend.yml to avoid deprecation warnings. #71

Update build-frontend.yml to avoid deprecation warnings.

Update build-frontend.yml to avoid deprecation warnings. #71

name: Build-Frontend
on:
push:
branches: [ main ]
env:
IMAGE_NAME: unicorn-frontend
jobs:
push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build image
env:
CLIENT_ID: ${{ secrets.PROD_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.PROD_CLIENT_SECRET }}
run: docker build . -f Dockerfile --tag image --build-arg CLIENT_ID=$CLIENT_ID --build-arg CLIENT_SECRET=$CLIENT_SECRET
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository }}/$IMAGE_NAME
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag image $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION