scraper-gasoline-italian-prices #414
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: scraper-gasoline-italian-prices | |
env: | |
DOCKER_REGISTRY: ghcr.io | |
DOCKER_USERNAME: gabrieleghisleni | |
DOCKER_REPOSITORY: gasolineprices | |
DOCKER_IMAGE: ghcr.io/gabrieleghisleni/gasolineprices:master | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '15 1 */2 * *' | |
jobs: | |
login-registry: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.DOCKER_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
deploy: | |
needs: login-registry | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Run refresh details script | |
run: docker run -v ${PWD}/data:/home/src/data ${{ env.DOCKER_IMAGE }} poetry run python fetch_and_save.py | |
- name: Commit and push changes | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "Update data" | |
git push | |
tests: | |
needs: deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Run tests | |
continue-on-error: true | |
run: docker run ${{ env.DOCKER_IMAGE }} poetry run pytest test_refresh_prices.py | |