Skip to content

fix: category names

fix: category names #1

name: Publish frontend to GHCR
on:
push:
# Only run this workflow if it is a commit to main.
branches:
- main
- SPI-25-deploy
# Only run this workflow if the commit has modified files from frontend
paths:
- frontend/**
env:
IMAGE_NAME: frontend-midpoint
jobs:
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v2
- name: Build image
run: docker build . --file Dockerfile --build-arg VITE_GOOGLE_MAPS_API=${{secrets.VITE_GOOGLE_MAPS_API}} --build-arg VITE_CLIENT_ID=${{secrets.VITE_CLIENT_ID}} --build-arg VITE_CLIENT_SECRET=${{secrets.VITE_CLIENT_SECRET}} --build-arg VITE_REDIRECT_URL=${{secrets.VITE_REDIRECT_URL}} --tag $IMAGE_NAME
- name: Log into GitHub Container Registry
# TODO: Create a Personal Access Tokens (PAT) with `read:packages` and `write:packages` scopes and save it as an Actions secret `CR_PAT`
run: echo "${{ secrets.CR_PAT }}" | docker login https://ghcr.io -u MadisonMajarais --password-stdin
- name: Push image to GitHub Container Registry
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# 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_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: executing remote ssh commands using ssh key
uses: appleboy/[email protected]
with:
host: 159.203.1.240
username: root
password: ${{ secrets.KEY }}
script: |
docker compose down
docker compose pull && docker compose up -d