-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (64 loc) · 2.43 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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}}
- 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 }}