|
| 1 | +name: Update Mons data |
| 2 | + |
| 3 | +on: |
| 4 | + # Run every Monday at 1:00 UTC |
| 5 | + schedule: |
| 6 | + - cron: "0 1 * * 1" |
| 7 | + push: |
| 8 | + paths: |
| 9 | + - ".github/workflows/update-mons.yml" |
| 10 | + - "cities/mons/config.php" |
| 11 | + - "cities/mons/overpass/*" |
| 12 | + pull_request: |
| 13 | + paths: |
| 14 | + - ".github/workflows/update-mons.yml" |
| 15 | + - "cities/mons/config.php" |
| 16 | + - "cities/mons/overpass/*" |
| 17 | + |
| 18 | +jobs: |
| 19 | + update-data: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v2 |
| 23 | + with: |
| 24 | + persist-credentials: false |
| 25 | + submodules: true |
| 26 | + - name: Use PHP 7.4 |
| 27 | + uses: shivammathur/setup-php@v2 |
| 28 | + with: |
| 29 | + php-version: 7.4 |
| 30 | + extensions: curl, pdo, sqlite3 |
| 31 | + - name: Validate composer.json and composer.lock |
| 32 | + run: composer validate |
| 33 | + - name: Install dependencies |
| 34 | + run: composer install --prefer-dist --no-progress --no-suggest |
| 35 | + |
| 36 | + - name: Checkout submodule to master |
| 37 | + working-directory: cities/mons |
| 38 | + run: git checkout -q master |
| 39 | + - name: Update sub-modules |
| 40 | + run: git submodule update --remote --merge cities/mons |
| 41 | + |
| 42 | + - name: Run update |
| 43 | + run: composer run update-data -- --city=mons |
| 44 | + |
| 45 | + - name: Upload artifact |
| 46 | + uses: actions/upload-artifact@v2 |
| 47 | + with: |
| 48 | + name: Mons |
| 49 | + path: cities/mons/data/* |
| 50 | + |
| 51 | + - name: Commit sub-module |
| 52 | + if: ${{ github.event != 'pull_request' }} |
| 53 | + working-directory: cities/mons |
| 54 | + run: | |
| 55 | + git config user.name github-actions |
| 56 | + git config user.email github-actions@github.com |
| 57 | + git add data/* |
| 58 | + git commit -m "🗃 Update data" |
| 59 | + - name: Push to sub-module |
| 60 | + uses: ad-m/github-push-action@master |
| 61 | + if: ${{ github.event != 'pull_request' }} |
| 62 | + with: |
| 63 | + github_token: ${{ secrets.ACCESS_TOKEN }} |
| 64 | + directory: cities/mons |
| 65 | + repository: openknowledgebe/equalstreetnames-mons |
| 66 | + - name: Commit repository |
| 67 | + if: ${{ github.event != 'pull_request' }} |
| 68 | + run: | |
| 69 | + git config user.name github-actions |
| 70 | + git config user.email github-actions@github.com |
| 71 | + git pull |
| 72 | + git add cities/mons |
| 73 | + git commit -m "🗃 Update Mons sub-module" |
| 74 | + - name: Push to repository |
| 75 | + uses: ad-m/github-push-action@master |
| 76 | + if: ${{ github.event != 'pull_request' }} |
| 77 | + with: |
| 78 | + github_token: ${{ secrets.ACCESS_TOKEN }} |
0 commit comments