Skip to content

Commit

Permalink
Add GitHub Actions for Mons, Belgium
Browse files Browse the repository at this point in the history
  • Loading branch information
jbelien committed Jan 5, 2021
1 parent e636b78 commit 6ff956d
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/deploy-mons.yml
Original file line number Diff line number Diff line change
@@ -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
78 changes: 78 additions & 0 deletions .github/workflows/update-mons.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit 6ff956d

Please sign in to comment.