gitlab pages

1、gitlab注册:https://gitlab.com/

2、国内手机号验证解决办法:https://blog.csdn.net/2203_75961777/article/details/136129428

3、gitlab发布静态页面:

创建group:

 

 4、创建project:

 

 5、创建静态页面index.html:

 6、创建.gitlab-ci.yml

pages:
  stage: deploy
  script:
    - mkdir .public
    - cp -r ./* .public
    - rm -rf public
    - mv .public public
  artifacts:
    paths:
      - public
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

 cicd发布完成:

 浏览器访问:https://jsonhcdev-2d4fc6.gitlab.io

 还需要将这个访问权限打开:

 

 

 

现在将一个vue源代码进行page发布:

 配置cicd文件:

# The Docker image that will be used to build your app
image: registry.cn-hangzhou.aliyuncs.com/jsonhc/node:16.13.0-alpine
create-pages:
  pages:
    # The folder that contains the files to be exposed at the Page URL
    publish: dist
  rules:
    # This ensures that only pushes to the default branch will trigger
    # a pages deploy
    - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
  # Functions that should be executed before the build script is run
  before_script:
    - npm install
  script:
    - npm run build

 job执行完成没有报错后,点击deploy---->pages:

 访问浏览器:

 不涉及后端,全静态页面通过gitlab进行部署

posted on 2025-07-22 22:26  wadeson  阅读(21)  评论(0)    收藏  举报