From 6ff956d3e5979689c18669016a4d248232135b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Tue, 5 Jan 2021 12:14:19 +0100 Subject: [PATCH] Add GitHub Actions for Mons, Belgium --- .github/workflows/deploy-mons.yml | 33 +++++++++++++ .github/workflows/update-mons.yml | 78 +++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 .github/workflows/deploy-mons.yml create mode 100644 .github/workflows/update-mons.yml diff --git a/.github/workflows/deploy-mons.yml b/.github/workflows/deploy-mons.yml new file mode 100644 index 000000000..6b16b9860 --- /dev/null +++ b/.github/workflows/deploy-mons.yml @@ -0,0 +1,33 @@ + +name: Deploy Mons + +on: + push: + paths: + - 'cities/mons' + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false + submodules: true + + - name: Install and Build + run: | + npm install + npm run build:mons + env: + MAPBOX_TOKEN: ${{ secrets.MAPBOX_TOKEN }} + + - name: Deploy + uses: JamesIves/github-pages-deploy-action@3.6.2 + with: + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + REPOSITORY_NAME: openknowledgebe/equalstreetnames-mons + BRANCH: gh-pages # The branch the action should deploy to. + FOLDER: 'dist/mons' # The folder the action should deploy. + CLEAN: true # Automatically remove deleted files from the deploy branch diff --git a/.github/workflows/update-mons.yml b/.github/workflows/update-mons.yml new file mode 100644 index 000000000..daa7f6cb9 --- /dev/null +++ b/.github/workflows/update-mons.yml @@ -0,0 +1,78 @@ +name: Update Mons data + +on: + # Run every Monday at 1:00 UTC + schedule: + - cron: "0 1 * * 1" + push: + paths: + - ".github/workflows/update-mons.yml" + - "cities/mons/config.php" + - "cities/mons/overpass/*" + pull_request: + paths: + - ".github/workflows/update-mons.yml" + - "cities/mons/config.php" + - "cities/mons/overpass/*" + +jobs: + update-data: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false + submodules: true + - name: Use PHP 7.4 + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + extensions: curl, pdo, sqlite3 + - name: Validate composer.json and composer.lock + run: composer validate + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Checkout submodule to master + working-directory: cities/mons + run: git checkout -q master + - name: Update sub-modules + run: git submodule update --remote --merge cities/mons + + - name: Run update + run: composer run update-data -- --city=mons + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: Mons + path: cities/mons/data/* + + - name: Commit sub-module + if: ${{ github.event != 'pull_request' }} + working-directory: cities/mons + run: | + git config user.name github-actions + git config user.email github-actions@github.com + git add data/* + git commit -m "🗃 Update data" + - name: Push to sub-module + uses: ad-m/github-push-action@master + if: ${{ github.event != 'pull_request' }} + with: + github_token: ${{ secrets.ACCESS_TOKEN }} + directory: cities/mons + repository: openknowledgebe/equalstreetnames-mons + - name: Commit repository + if: ${{ github.event != 'pull_request' }} + run: | + git config user.name github-actions + git config user.email github-actions@github.com + git pull + git add cities/mons + git commit -m "🗃 Update Mons sub-module" + - name: Push to repository + uses: ad-m/github-push-action@master + if: ${{ github.event != 'pull_request' }} + with: + github_token: ${{ secrets.ACCESS_TOKEN }}