Compare commits
3
Commits
c64d5a96cb
...
92f110c5e1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92f110c5e1 | ||
|
|
4e2c837eee | ||
|
|
c18893e6f3 |
No files matched your search
+13
-4
@@ -8,16 +8,25 @@ runs:
|
|||||||
with:
|
with:
|
||||||
entrypoint: "/bin/bash"
|
entrypoint: "/bin/bash"
|
||||||
args: |
|
args: |
|
||||||
-c "export https_proxy=http://100.100.13.14:8118 && \
|
-c "npm pkg set version=${{ github.ref_name }} && \
|
||||||
export http_proxy=http://100.100.13.14:8118 && \
|
|
||||||
npm pkg set version=${{ github.ref_name }} && \
|
|
||||||
npm ci && \
|
npm ci && \
|
||||||
npm run build-only"
|
npm run build-only"
|
||||||
|
|
||||||
|
# 项目根目录有 nginx.conf 就用项目自己的(例如要开 COOP/COEP 之类的自定义配置),
|
||||||
|
# 没有才用本 action 自带的通用配置
|
||||||
- uses: docker://ubuntu:latest
|
- uses: docker://ubuntu:latest
|
||||||
with:
|
with:
|
||||||
entrypoint: "/bin/bash"
|
entrypoint: "/bin/bash"
|
||||||
args: |
|
args: |
|
||||||
-c 'cp "${{ github.action_path }}/nginx.conf" ./ && cp "${{ github.action_path }}/vue.Dockerfile" ./Dockerfile'
|
-c '
|
||||||
|
set -e
|
||||||
|
if [ -f ./nginx.conf ]; then
|
||||||
|
echo "nginx.conf:用项目根目录的"
|
||||||
|
else
|
||||||
|
cp "${{ github.action_path }}/nginx.conf" ./nginx.conf
|
||||||
|
echo "nginx.conf:用 action 自带的"
|
||||||
|
fi
|
||||||
|
cp "${{ github.action_path }}/vue.Dockerfile" ./Dockerfile
|
||||||
|
'
|
||||||
|
|
||||||
- uses: actions/docker-build-push@main
|
- uses: actions/docker-build-push@main
|
||||||
+12
@@ -3,6 +3,18 @@ server {
|
|||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
|
# 👇 跨域配置开始
|
||||||
|
add_header Access-Control-Allow-Origin * always;
|
||||||
|
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS, PUT, DELETE' always;
|
||||||
|
add_header Access-Control-Allow-Headers '*, Origin, X-Requested-With, Content-Type, Accept, Authorization, X-Token' always;
|
||||||
|
add_header Access-Control-Allow-Credentials 'true' always;
|
||||||
|
|
||||||
|
# 处理预检 OPTIONS 请求
|
||||||
|
if ($request_method = 'OPTIONS') {
|
||||||
|
return 204;
|
||||||
|
}
|
||||||
|
# 👆 跨域配置结束
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user