fix deploy script
This commit is contained in:
parent
3760af175a
commit
26301bd805
1 changed files with 5 additions and 30 deletions
|
|
@ -25,39 +25,14 @@ jobs:
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: docker # node:22-bookworm (Debian) — has the Docker socket
|
runs-on: docker # node:22-bookworm — the runner has the host Docker socket mounted
|
||||||
# Only deploy from the default branch, and only when triggered manually,
|
# Manual-only, default branch only (equivalent to GitLab `when: manual` on CI_DEFAULT_BRANCH).
|
||||||
# matching `if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH / when: manual`.
|
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
|
if: ${{ github.event_name == 'workflow_dispatch' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
|
||||||
environment:
|
environment:
|
||||||
name: production
|
name: production
|
||||||
# url: https://jobs-scraper.ai-assistant-bot.xyz
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install ssh + rsync
|
- name: Build & start scraper-google
|
||||||
run: |
|
working-directory: services/scraper-google
|
||||||
apt-get update
|
run: docker compose up -d --build
|
||||||
apt-get install -y --no-install-recommends openssh-client rsync
|
|
||||||
|
|
||||||
- name: Set up SSH key
|
|
||||||
run: |
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
printf '%s' "${{ secrets.SSH_PRIVATE_KEY }}" | tr -d '\r' > ~/.ssh/id_rsa
|
|
||||||
chmod 600 ~/.ssh/id_rsa
|
|
||||||
ssh-keyscan -H "${{ secrets.DEPLOY_HOST }}" >> ~/.ssh/known_hosts
|
|
||||||
|
|
||||||
- name: Sync project to server
|
|
||||||
run: |
|
|
||||||
ssh "${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}" "mkdir -p /opt/apps/jobs-scraper"
|
|
||||||
rsync -az --delete \
|
|
||||||
--exclude='.git' \
|
|
||||||
--exclude='.env' \
|
|
||||||
--exclude='.env.*' \
|
|
||||||
--exclude='.local.env' \
|
|
||||||
./ "${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:/opt/apps/jobs-scraper/"
|
|
||||||
|
|
||||||
- name: Build & start on server
|
|
||||||
run: |
|
|
||||||
ssh "${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}" \
|
|
||||||
"cd /opt/apps/jobs-scraper/services/scraper-google && docker compose up -d --build"
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue