Added agent index sparql #87
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: CI CD - Test Server | |
on: | |
workflow_dispatch: | |
push: | |
branches: ['main'] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }}/artsdata-reconciliation | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16.20.1 | |
directory: . | |
- run: npm install | |
- run: npm test | |
build-and-push-image: | |
needs: test | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.PAT }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | |
with: | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
Deploy: | |
needs: build-and-push-image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Deploy in EC2 | |
env: | |
PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY }} | |
HOSTNAME : ${{ vars.HOSTNAME_TEST_SERVER_2 }} | |
USER_NAME : ubuntu | |
run: | | |
echo "$PRIVATE_KEY" > private_key && chmod 600 private_key | |
ssh -o StrictHostKeyChecking=no -i private_key ${USER_NAME}@${HOSTNAME} ' docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.PAT }} && docker pull ghcr.io/${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main && docker images && docker ps -q --filter name=artsdata-reconciliation | xargs -r docker rm -f && docker run -itd --restart always -p 443:443 --name artsdata-reconciliation ghcr.io/${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main && docker image prune -a -f && docker cp ./secrets artsdata-reconciliation:./usr/src/app/secrets' | |