refresh stations #159
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: refresh stations | |
env: | |
DOCKER_REGISTRY: ghcr.io | |
DOCKER_USERNAME: gabrieleghisleni | |
DOCKER_REPOSITORY: gasolineprices | |
DOCKER_IMAGE: ghcr.io/gabrieleghisleni/gasolineprices:master | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '15 3 */14 * *' | |
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: | |
runs-on: ubuntu-latest | |
needs: login-registry | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Refresh static stations | |
run: docker run -v ${PWD}/data/static_stations:/home/src/data/static_stations ${{ env.DOCKER_IMAGE }} poetry run python static_stations.py | |
- name: Run refresh details script | |
run: docker run -v ${PWD}/data/details:/home/src/data/details ${{ env.DOCKER_IMAGE }} poetry run python refresh_details.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 | |
test: | |
needs: deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Run tests | |
continue-on-error: true | |
run: docker run ${{ env.DOCKER_IMAGE }} poetry run pytest test_static_stations.py | |