mapcomplete/.github/workflows/theme_validation_and_deploy.yml

54 lines
1.4 KiB
YAML
Raw Normal View History

2021-06-01 13:11:48 +02:00
name: Theme Validation and deployment
on:
push:
branches:
- master
2021-06-01 13:11:48 +02:00
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
2021-06-01 14:16:31 +02:00
- name: Set up Node.js
uses: actions/setup-node@v1.2.0
with:
node-version: '16'
2021-06-01 14:16:31 +02:00
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
2021-06-01 14:16:31 +02:00
- name: install deps
run: npm ci
2021-06-01 14:16:31 +02:00
- name: create generated dir
run: mkdir ./assets/generated
- name: Prepare deploy
run: npm run prepare-deploy
2021-06-01 13:11:48 +02:00
- name: Clone deployment repo
2021-06-01 14:06:12 +02:00
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
run: |
2021-06-01 13:11:48 +02:00
echo "Cloning destination repo"
2021-06-01 14:03:35 +02:00
git config --global user.email "pietervdvn@posteo.net"
2021-06-01 13:11:48 +02:00
git config --global user.name "MapComplete"
2021-06-01 14:46:27 +02:00
git clone --depth 1 --single-branch --branch main "https://x-access-token:$DEPLOY_KEY@github.com/MapComplete/mapcomplete.github.io.git"
2021-06-01 13:11:48 +02:00
echo "Destination repo is cloned"
2021-06-01 13:26:51 +02:00
- name: "Copying files"
run: |
echo "Deploying"
2021-06-01 14:16:31 +02:00
rm -rf mapcomplete.github.io/*
2021-06-01 14:37:44 +02:00
cp -r dist/* mapcomplete.github.io/
2021-06-01 13:43:09 +02:00
cd mapcomplete.github.io/
2021-06-01 13:35:31 +02:00
echo "mapcomplete.osm.be" > CNAME
2021-06-01 13:46:04 +02:00
git add *
2021-06-01 14:53:16 +02:00
if git status | grep -q "Changes to be committed"
then
git commit -am "Deploying a new version"
git push
else
echo "No changes to commit"
fi