generated from workadventure/map-starter-kit
-
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (49 loc) · 1.87 KB
/
build-and-deploy.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
name: Optimize map and deploy
on: [push]
permissions:
contents: write
pages: write
actions: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
- name: "Install dependencies"
run: npm install
- name: "Build scripts"
run: npm run build
- name: Get API KEY from secrets
env:
MAP_STORAGE_API_KEY: ${{ secrets.MAP_STORAGE_API_KEY }}
run: echo "MAP_STORAGE_API_KEY=${MAP_STORAGE_API_KEY}" >> $GITHUB_ENV
- name: Get MAP STORAGE URL from secrets
env:
MAP_STORAGE_URL: ${{ secrets.MAP_STORAGE_URL }}
run: echo "MAP_STORAGE_URL=${MAP_STORAGE_URL}" >> $GITHUB_ENV
- name: Generate .env.secret
run: echo "MAP_STORAGE_API_KEY=${{ secrets.MAP_STORAGE_API_KEY }}" > .env.secret
- name: Extract UPLOAD_MODE from .env
run: echo "UPLOAD_MODE=$(grep '^[^#]*UPLOAD_MODE' .env | cut -d '=' -f2)" >> $GITHUB_ENV
- name: Extract UPLOAD DIRECTORY from Github
run: echo "UPLOAD_DIRECTORY=${{ github.actor }}-${{ github.event.repository.name }}" >> $GITHUB_ENV
- name: Create or update .env file
run: |
UPLOAD_DIRECTORY="${{ github.actor }}-${{ github.event.repository.name }}"
echo "UPLOAD_DIRECTORY=${UPLOAD_DIRECTORY}" > .env
- name: Deploy in MAP STORAGE
if: ${{ env.UPLOAD_MODE == 'MAP_STORAGE' }}
run: npm run upload-only
- name: Deploy on GITHUB PAGES
if: ${{ env.UPLOAD_MODE == 'GH_PAGES' }}
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: dist/
BASE_BRANCH: master