Merge pull request #75 from NeuralTeam/feature/fix-warnings-from-desi… #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:develop |