diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..020b86e --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,41 @@ +name: Build and publish to PyPI + +on: + push: + branches: + - main + release: + types: + - published + +jobs: + publish: + if: github.repository == 'mikepqr/real-estate-scrape-src' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - name: Install pypa/build + run: >- + python -m + pip install + build + --user + - name: Build binary wheel and source tarball + run: >- + python -m + build + --sdist + --wheel + --outdir dist/ + - name: Publish to PyPI + if: github.event.action == 'published' + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/real-estate-scrape.yml b/.github/workflows/real-estate-scrape.yml deleted file mode 100644 index efc0bf1..0000000 --- a/.github/workflows/real-estate-scrape.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: real-estate-scrape - -on: - workflow_dispatch: - schedule: - - cron: '00 05 * * *' - -jobs: - real-estate-scrape: - runs-on: ubuntu-latest - steps: - - name: Check out repo - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - name: Install real-estate-scrape and dependencies - run: | - pip install . - - name: Run real-estate-scrape - env: - REDFIN_URL: ${{ secrets.REDFIN_URL }} - ZILLOW_URL: ${{ secrets.ZILLOW_URL }} - SCRAPERAPI_KEY: ${{ secrets.SCRAPERAPI_KEY }} - run: cd eg && real-estate-scrape - - name: Commit and push if it changed - run: |- - git config --global user.name "scraper-bot" - git config user.email "actions@users.noreply.github.com" - git add -A - timestamp=$(date -u) - git commit -m "Scraped at ${timestamp}" || exit 0 - git push - - name: Set workflow status - # success if NaN is not present in last line of data.csv - run: tail -1 data.csv | grep -q -v NaN