Skip to content

update ci

update ci #75

Workflow file for this run

name: Deploy
on:
push:
branches: [ main ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Frontend
id: frontend
env:
REGISTRY_NAME: pinkynrg
REPOSITORY_NAME: hoomes_frontend
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -f Dockerfile.frontend -t $REGISTRY_NAME/$REPOSITORY_NAME:$IMAGE_TAG -t $REGISTRY_NAME/$REPOSITORY_NAME:latest .
echo "Pushing image to Registry..."
docker login -u pinkynrg -p ${{ secrets.DOCKER_HUB_LOGIN_TOKEN }}
docker push $REGISTRY_NAME/$REPOSITORY_NAME:$IMAGE_TAG
docker push $REGISTRY_NAME/$REPOSITORY_NAME:latest
echo "::set-output name=image::$REGISTRY_NAME/$REPOSITORY_NAME:$IMAGE_TAG"
- name: Backend
id: backend
env:
REGISTRY_NAME: pinkynrg
REPOSITORY_NAME: hoomes_backend
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -f Dockerfile.backend -t $REGISTRY_NAME/$REPOSITORY_NAME:$IMAGE_TAG -t $REGISTRY_NAME/$REPOSITORY_NAME:latest .
echo "Pushing image to Registry..."
docker login -u pinkynrg -p ${{ secrets.DOCKER_HUB_LOGIN_TOKEN }}
docker push $REGISTRY_NAME/$REPOSITORY_NAME:$IMAGE_TAG
docker push $REGISTRY_NAME/$REPOSITORY_NAME:latest
echo "::set-output name=image::$REGISTRY_NAME/$REPOSITORY_NAME:$IMAGE_TAG"
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: build
steps:
- name: Pull and Redeploy
run: |
curl --location --request PUT 'https://portainer.francescomeli.com/api/stacks/12/git/redeploy?endpointId=2' \
--header 'X-API-Key: ${{ secrets.PORTAINER_TOKEN }}' \
--header 'Content-Type: application/json' \
--data '{
"pullImage": true,
"RepositoryAuthentication": true,
"env":[
{"name":"NORD_VPN_PRIVATE_KEY","value": "${{ secrets.NORD_VPN_PRIVATE_KEY }}" }
]
}'