Skip to content

Merge pull request #161 from Geoportail-Luxembourg/GSLUX-707_drawStyle #853

Merge pull request #161 from Geoportail-Luxembourg/GSLUX-707_drawStyle

Merge pull request #161 from Geoportail-Luxembourg/GSLUX-707_drawStyle #853

Workflow file for this run

name: CI
on:
push:
tags:
- '*'
branches:
- main
pull_request:
branches:
- main
jobs:
lux-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- run: npm ci
# - name: Build library and increment version tag (only on merge)
# if: github.event_name != 'pull_request'
# shell: bash
# run: |
# npm run build:lib:prod
# git config user.name github-actions
# git config user.email github-actions@github.com
# git add .
# git commit -m "chore(lib): npm run build:lib:prod"
# npm version patch
# git push
# git push --tags
- name: Get branch name (merge)
if: github.event_name != 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
- name: Get branch name (pull request)
if: github.event_name == 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
- name: Set LUX_BASE ENV
shell: bash
run: echo "LUX_BASE=$(echo /luxembourg-geoportail/${BRANCH_NAME}/)" >> $GITHUB_ENV
- name: Set VITE_DEPLOY_GHPAGES ENV
shell: bash
run: echo "VITE_DEPLOY_GHPAGES=true" >> $GITHUB_ENV
- run: npm run build-only -- --base=${{env.LUX_BASE}} --mode=staging
- name: deploy to gh pages
run: |
echo "Deploying to directory: ${{env.BRANCH_NAME}}"
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
npx gh-pages --dist dist/ --dest ${{env.BRANCH_NAME}} --remove "${{env.BRANCH_NAME}}/**" --no-history --dotfiles true --repo "https://${GITHUB_ACTOR}:${{secrets.GITHUB_TOKEN}}@github.com/${GITHUB_REPOSITORY}.git"
- name: add PR comment
uses: thollander/actions-comment-pull-request@v1
if: github.event_name == 'pull_request'
with:
message: 'GitHub Pages links:
* Luxembourg-geoportail: https://geoportail-luxembourg.github.io/luxembourg-geoportail/${{env.BRANCH_NAME}}/'
comment_includes: 'GitHub Pages links:'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}