Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92f110c5e1 | ||
|
|
4e2c837eee | ||
|
|
c18893e6f3 |
+13
-4
@@ -8,16 +8,25 @@ runs:
|
||||
with:
|
||||
entrypoint: "/bin/bash"
|
||||
args: |
|
||||
-c "export https_proxy=http://100.100.13.14:8118 && \
|
||||
export http_proxy=http://100.100.13.14:8118 && \
|
||||
npm pkg set version=${{ github.ref_name }} && \
|
||||
-c "npm pkg set version=${{ github.ref_name }} && \
|
||||
npm ci && \
|
||||
npm run build-only"
|
||||
|
||||
# 项目根目录有 nginx.conf 就用项目自己的(例如要开 COOP/COEP 之类的自定义配置),
|
||||
# 没有才用本 action 自带的通用配置
|
||||
- uses: docker://ubuntu:latest
|
||||
with:
|
||||
entrypoint: "/bin/bash"
|
||||
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
|
||||
|
||||
+12
@@ -3,6 +3,18 @@ server {
|
||||
root /usr/share/nginx/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 / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user