Skip to content

Merge pull request #403 from osscameroon/deploy-using-docker #5

Merge pull request #403 from osscameroon/deploy-using-docker

Merge pull request #403 from osscameroon/deploy-using-docker #5

name: meilisearch index generator deploy
on:
push:
paths:
- .github/workflows/meilisearch-index-generator-deploy.yaml
- tools/meilisearch-index-generator/**
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: tools/meilisearch-index-generator
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install virtualenv
make install-deps
# uncomment when we add tests
# - name: Run unit tests
# run: |
# make test
- name: Setup env variables
# multistring env variables check this out
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#multiline-strings
#
run: |
echo 'SCP_FILES=tools/meilisearch-index-generator/build.tar' >> $GITHUB_ENV
echo 'ARCHIVE=build.tar' >> $GITHUB_ENV
echo 'SCP_TARGET<<EOF' >> $GITHUB_ENV
cat ./deploy/target.txt >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
tar -cvf build.tar $(find ./* -maxdepth 0 | grep -vf ./deploy/excluded_files.txt)
- name: Copy file via scp
uses: appleboy/scp-action@master
with:
host: ${{ secrets.DROPLET_HOST }}
username: ${{ secrets.DROPLET_DEPLOY_USERNAME }}
key: ${{ secrets.DROPLET_DEPLOY_SSHKEY }}
source: ${{ env.SCP_FILES }}
target: ${{ env.SCP_TARGET }}
overwrite: true
- name: Executing remote command
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DROPLET_HOST }}
username: ${{ secrets.DROPLET_DEPLOY_USERNAME }}
key: ${{ secrets.DROPLET_DEPLOY_SSHKEY }}
script: cd ${{ env.SCP_TARGET }}/tools/meilisearch-index-generator && tar -xvf ${{ env.ARCHIVE }} && rm -rf ${{ env.ARCHIVE }}