jobs-monorepo/.forgejo/workflows/deploy-scraper-google.yml
Elshimy Ziad Magdy Taha 96532caddf
Some checks failed
Deploy scraper-google / build (push) Failing after 4m46s
Deploy scraper-google / deploy (push) Has been skipped
pipeline
2026-07-09 17:43:19 +05:00

56 lines
2.1 KiB
YAML

name: Deploy scraper-google
# Forgejo Actions (git.altricade.com). Workflow files live in .forgejo/workflows/.
# Mirrors the old .gitlab-ci.yml deploy: build/test the Go code, then SSH + rsync
# to the server and `docker compose up -d --build` for scraper-google.
on:
push:
workflow_dispatch: {} # manual "deploy" button, matching the GitLab `when: manual` gate
jobs:
build:
runs-on: go # golang:1.23-bookworm — Go auto-fetches the 1.24 toolchain (go.work is 1.24)
steps:
- uses: actions/checkout@v4
- run: go version
- run: go build ./...
- run: go test ./...
deploy:
needs: build
runs-on: docker # node:22-bookworm (Debian) — has the Docker socket
# Only deploy from the default branch, and only when triggered manually,
# 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) }}
environment:
name: production
# url: https://jobs-scraper.ai-assistant-bot.xyz
steps:
- uses: actions/checkout@v4
- name: Install ssh + rsync
run: |
apt-get update
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"