-
Notifications
You must be signed in to change notification settings - Fork 3
125 lines (120 loc) · 3.91 KB
/
install.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Install Site
on:
# Runs on pushes targeting the default branch
push:
branches: ["master", "gh-pages"]
paths:
- "**/*.html"
- "**/*.css"
- "**/*.js"
- "**/*.json"
- "**/workflows/install.yml"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
ref:
description: "checkout branch or commit"
required: true
default: "master"
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions: write-all
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: "github-pages"
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max_old_space_size=8192" #8192 4096 --expose-gc
YARN_ENABLE_IMMUTABLE_INSTALLS: false
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN || secrets.GITHUB_TOKEN || github.token }}
node-version: 18.x
YARN_CHECKSUM_BEHAVIOR: update
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
token: ${{ env.ACCESS_TOKEN }}
#submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
- run: corepack enable
- name: install validator
run: yarn install
working-directory: github-actions
id: install
continue-on-error: true
- run: |
YARN_ENABLE_IMMUTABLE_INSTALLS=false
truncate -s 0 yarn.lock
yarn cache clean --all
rm -rf node_modules
YARN_CHECKSUM_BEHAVIOR=update yarn install
working-directory: github-actions
if: steps.install.outcome == 'failure'
name: clean install github validator
shell: bash
- name: fix github config
run: |
echo "fix end of lines"
git config --global user.email "dimaslanjaka@gmail.com"
git config --global user.name "dimaslanjaka"
git config core.eol lf
git config core.autocrlf input
git checkout-index --force --all
echo "fix case-sensitive"
git config --global user.email "dimaslanjaka@gmail.com"
git config --global user.name "dimaslanjaka"
git rm -r --cached .
git add --all .
if [ $(git status --porcelain | wc -l) -gt "0" ]; then
git commit -a -m "fix: file name casing"
fi
- name: install
run: |
corepack enable
yarn dlx npm i -g npm
rm -rf node_modules
if [ -f "package-lock.json" ]; then
npm install --omit=dev --production
else
yarn install
fi
- name: validate paths
run: node github-actions/index.js
id: validate
- name: cleanup unused files
id: cleanup
run: |
rm -rf github-actions
find . -name '.github' -type d -prune -exec rm -rf '{}' +
rm -rf .devcontainer
rm -rf .npmrc
rm -rf .gitmodules
rm -rf github-actions-validator.config.yml
find . -name '.vscode' -type d -prune -exec rm -rf '{}' +
find . -name 'tmp' -type d -prune -exec rm -rf '{}' +
- name: Setup Pages
uses: actions/configure-pages@v5
if: steps.validate.outcome == 'success'
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
if: steps.validate.outcome == 'success'
with:
# Upload entire repository
path: "."
name: "github-pages"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
if: steps.validate.outcome == 'success'
with:
token: ${{ env.ACCESS_TOKEN }}
artifact_name: "github-pages"