Skip to content

Merge pull request #91 from NeuralTeam/bugfix/fix-news-search-and-image #54

Merge pull request #91 from NeuralTeam/bugfix/fix-news-search-and-image

Merge pull request #91 from NeuralTeam/bugfix/fix-news-search-and-image #54

name: Develop
on:
push:
branches: ['develop']
env:
USERNAME: ${{ github.actor }}
REGISTRY: ghcr.io
IMAGE_NAME: neuralteam/vsau-frontend
CONTAINER_NAME: vsau-frontend
jobs:
build-and-push-image:
name: 'Build and push image'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Get repo
uses: actions/checkout@v4
- name: Get docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
- name: Log in to the registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.USERNAME }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image to the registry
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
deploy-to-server:
name: 'Deploy to the server'
runs-on: ubuntu-latest
needs: [build-and-push-image]
permissions:
packages: read
steps:
- name: "Stage 'Develop'"
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
docker login ${{ env.REGISTRY }} --username ${{ env.USERNAME }} --password ${{ secrets.GITHUB_TOKEN }}
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:develop
docker rm -f ${{ env.CONTAINER_NAME }}
docker container run -d -p "127.0.0.1:3015:3000" --name ${{ env.CONTAINER_NAME }} -e REVALIDATION_TOKEN=${{ secrets.REVALIDATION_TOKEN }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:develop