首页 > 其他分享 >ABP模块签入GitLab后自动打包并推送到ProGet

ABP模块签入GitLab后自动打包并推送到ProGet

时间:2023-05-20 13:24:32浏览次数:42  
标签:ProGet Study GitLab Trade ABP VERSION build CONFIG ID

# 1、添加一个名为下划线的解决方案文件夹

1

# 2、把解决方案根目录下的几个必要的文件添加到上述文件夹下

2

3

# 3、修改NuGet.Config,添加私有NuGet服务器的网址,并配置用户名和密码:

ABP Suite模板生成的NuGet.Config是这样的:

4

添加一行自己服务器的配置,另外有对应的节点设置用户名和密码:

4-1

#4、在解决方案根目录创建文件.gitlab-ci.yml

5

文件内容如下图所示:

8

为方便大家复制,代码块如下:

# This file is a template, and might need editing before it works on your project.
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml

# This is a sample GitLab CI/CD configuration file that should run without any modifications.
# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts,
# it uses echo commands to simulate the pipeline execution.
#
# A pipeline is composed of independent jobs that run scripts, grouped into stages.
# Stages run in sequential order, but jobs within stages run in parallel.
#
# For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages

stages:          # List of stages for jobs, and their order of execution
  - build
  - test
  - deploy
  - update-version
  - trigger-other-project

variables:
    CONFIG_VERSION_ID : 2023.51.$CI_PIPELINE_IID
    NEXUS_REPO : https://proget.abcdefg.cn/nuget/Study/
    NUGET_API_KEY : aeceb210f5irikfjskfiiiwoirwiirrie6a84817e68147
    CONFIG_NUPKG_OUTPUT_DIR : /home/gitlab-runner/nupkg/study/trade
    # Use no compression for caches
    CACHE_COMPRESSION_LEVEL: "fastest"

build-job:       # This job runs in the build stage, which runs first.
  stage: build
  retry: 2
  tags:
    - shell
  before_script:
    - dotnet nuget locals plugins-cache --clear
  script:
    - echo "Compiling the code..."
    - cd .
    - dotnet build "src/Study.Trade.Application/Study.Trade.Application.csproj" -c Release --force -p:Version=$CONFIG_VERSION_ID
    - dotnet build "src/Study.Trade.Application.Contracts/Study.Trade.Application.Contracts.csproj" -c Release --force -p:Version=$CONFIG_VERSION_ID
    - dotnet build "src/Study.Trade.Blazor/Study.Trade.Blazor.csproj" -c Release --force -p:Version=$CONFIG_VERSION_ID
    - dotnet build "src/Study.Trade.Blazor.Server/Study.Trade.Blazor.Server.csproj" -c Release --force -p:Version=$CONFIG_VERSION_ID
    - dotnet build "src/Study.Trade.Blazor.WebAssembly/Study.Trade.Blazor.WebAssembly.csproj" -c Release --force -p:Version=$CONFIG_VERSION_ID
    - dotnet build "src/Study.Trade.Domain/Study.Trade.Domain.csproj" -c Release --force -p:Version=$CONFIG_VERSION_ID
    - dotnet build "src/Study.Trade.Domain.Shared/Study.Trade.Domain.Shared.csproj" -c Release --force -p:Version=$CONFIG_VERSION_ID
    - dotnet build "src/Study.Trade.EntityFrameworkCore/Study.Trade.EntityFrameworkCore.csproj" -c Release --force -p:Version=$CONFIG_VERSION_ID
    - dotnet build "src/Study.Trade.HttpApi/Study.Trade.HttpApi.csproj" -c Release --force -p:Version=$CONFIG_VERSION_ID
    - dotnet build "src/Study.Trade.HttpApi.Client/Study.Trade.HttpApi.Client.csproj" -c Release --force -p:Version=$CONFIG_VERSION_ID
    - dotnet build "src/Study.Trade.Web/Study.Trade.Web.csproj" -c Release --force -p:Version=$CONFIG_VERSION_ID
    - dotnet pack "src/Study.Trade.Application/Study.Trade.Application.csproj" -c Release --no-build -o $CONFIG_NUPKG_OUTPUT_DIR -p:PackageVersion=$CONFIG_VERSION_ID
    - dotnet pack "src/Study.Trade.Application.Contracts/Study.Trade.Application.Contracts.csproj" -c Release --no-build -o $CONFIG_NUPKG_OUTPUT_DIR -p:PackageVersion=$CONFIG_VERSION_ID
    - dotnet pack "src/Study.Trade.Blazor/Study.Trade.Blazor.csproj" -c Release --no-build -o $CONFIG_NUPKG_OUTPUT_DIR -p:PackageVersion=$CONFIG_VERSION_ID
    - dotnet pack "src/Study.Trade.Blazor.Server/Study.Trade.Blazor.Server.csproj" -c Release --no-build -o $CONFIG_NUPKG_OUTPUT_DIR -p:PackageVersion=$CONFIG_VERSION_ID
    - dotnet pack "src/Study.Trade.Blazor.WebAssembly/Study.Trade.Blazor.WebAssembly.csproj" -c Release --no-build -o $CONFIG_NUPKG_OUTPUT_DIR -p:PackageVersion=$CONFIG_VERSION_ID
    - dotnet pack "src/Study.Trade.Domain/Study.Trade.Domain.csproj" -c Release --no-build -o $CONFIG_NUPKG_OUTPUT_DIR -p:PackageVersion=$CONFIG_VERSION_ID
    - dotnet pack "src/Study.Trade.Domain.Shared/Study.Trade.Domain.Shared.csproj" -c Release --no-build -o $CONFIG_NUPKG_OUTPUT_DIR -p:PackageVersion=$CONFIG_VERSION_ID
    - dotnet pack "src/Study.Trade.EntityFrameworkCore/Study.Trade.EntityFrameworkCore.csproj" -c Release --no-build -o $CONFIG_NUPKG_OUTPUT_DIR -p:PackageVersion=$CONFIG_VERSION_ID
    - dotnet pack "src/Study.Trade.HttpApi/Study.Trade.HttpApi.csproj" -c Release --no-build -o $CONFIG_NUPKG_OUTPUT_DIR -p:PackageVersion=$CONFIG_VERSION_ID
    - dotnet pack "src/Study.Trade.HttpApi.Client/Study.Trade.HttpApi.Client.csproj" -c Release --no-build -o $CONFIG_NUPKG_OUTPUT_DIR -p:PackageVersion=$CONFIG_VERSION_ID
    - dotnet pack "src/Study.Trade.Web/Study.Trade.Web.csproj" -c Release --no-build -o $CONFIG_NUPKG_OUTPUT_DIR -p:PackageVersion=$CONFIG_VERSION_ID
    - echo "推送到Nexus 3服务器..."
    - cd $CONFIG_NUPKG_OUTPUT_DIR
    - dotnet nuget push *.$CONFIG_VERSION_ID.nupkg -k $NUGET_API_KEY -s $NEXUS_REPO
    - echo "Application successfully deployed."
更新版本号:   # This job runs in the test stage.
  stage: update-version    # It only starts when the job in the build stage completes successfully.
  before_script:
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    #- ssh-keyscan $APP_SERVER > ~/.ssh/known_hosts
    #- chmod 644 ~/.ssh/known_hosts
    - cd /root/.ssh
    - cp /home/gitlab-runner/ssh/* .
  script:
    - echo "部署到Brain测试站……"
    - cd /home/gitlab-runner/scripts
    #- ssh david@$APP_SERVER
    #- docker ps
    - bash update-version.sh "Directory.Build.Study.Trade.props" "Study_Trade_Version" $CONFIG_VERSION_ID
    
触发下游:
  stage: trigger-other-project
  trigger:
    project: study/blazor-one
    branch: main

# 4、把上述文件添加到解决方案文件夹下

6

# 5、签入代码

如果GitLab里面有Runner,就会自动打包并推送到ProGet了。

标签:ProGet,Study,GitLab,Trade,ABP,VERSION,build,CONFIG,ID
From: https://www.cnblogs.com/amisoft/p/17417080.html

相关文章

  • Abp 开发随机一
    abp官网:https://abp.io/  注册账号 1使用visualstuio点击“在终端打开”or windows中直接搜索PowerShell 2安装abp使用命令段输入  dotnettoolinstall-gVolo.Abp.Cli  执行安装使用abp查看当前volo.abp.cli版本如果版本比较低你可以更新版本......
  • abp框架Excel导出——基于vue
    @@abp到处excel https://blog.51cto.com/u_15162069/2747885https://www.cnblogs.com/JerryMouseLi/p/13399027.html abp框架Excel导出——基于vue 目录abp框架Excel导出——基于vue1.技术栈1.1前端采用vue,官方提供1.2后台是abp——aspnetboilerplate2.E......
  • ONEAbp
    快速开始首先,如果你没有安装ONEABPCLI,请先安装它:dotnettoolinstall-gONE.Abp.CliCopytoclipboardErrorCopied在一个空文件夹使用 abpnew 命令创建新解决方案:base模板oneabpnewAcme.BookStore-tbase-def-dbmspostgresqlCopytoclipboardErrorCopiedmi......
  • 使用ONE.Abp快速开发微服务,再也不用加班了
    项目背景公司采用项目制工作方式,因此在不同项目上可能存在多个团队开发独立的代码库,但通用的基础设施却是相同的,这可能导致每个项目都需要编写相同的代码,并重复造轮子。更严重的是,每个项目都有自己的用户体系,导致用户在使用不同的服务时需要重新登录,这不仅会破坏用户的体验,也不利......
  • 使用ONE.Abp快速开发微服务,再也不用加班了
    项目背景公司采用项目制工作方式,因此在不同项目上可能存在多个团队开发独立的代码库,但通用的基础设施却是相同的,这可能导致每个项目都需要编写相同的代码,并重复造轮子。更严重的是,每个项目都有自己的用户体系,导致用户在使用不同的服务时需要重新登录,这不仅会破坏用户的体验,也不利......
  • .gitlab-ci.yml 语法错误导致 runner 报错“expected shallow list”
    报错信息:Runningwithgitlab-runner15.11.0(xxx)ongitrunnrxxx,systemID:s_xxxPreparingthe"shell"executor00:00Preparingenvironment00:00GettingsourcefromGitrepository00:01Fetchingchangeswithgitdepthsetto20...Reinitializ......
  • gitlab-runner 中的 Docker-in-Docker
    笔者个人理解:gitlab-runner安装后就是一个监听状态的runner,而通过gitlab-runnerregister注册的“实例”其实只是预定义的配置节,当消息抵达后,gitlab-runner根据消息内容选择相应的配置节启动执行线程。为了方便阐述和理解,本文也将每个配置节/执行线程称为runner实例。runn......
  • 在gitlab上,把旧项目的分支代码,转移到新项目里,Git命令语句
    1clone老项目#gitclonegit@xxxx/demo.git2进入到demo目录#cddemo3移除老项目的地址替换成新项目#gitremoteset-url--pushorigingit@xxx/account.git4将镜像推到远程#gitpush-uoriginmaster ......
  • ABP - 模块加载机制
    Abp是一个基于模块化开发的应用程序框架,提供了模块化基础的架构和模块化加载的引擎。理解模块一个模块是对一个功能点的封装,可以独立成为一个包,实现了松耦合的代码组织方式。Abp框架的基本思想就是模块开发,模块就想乐高中的一块块积木,在项目中将不同功能点的模块引用进来,就像......
  • ABP 系列总结
    2019年第一次接触ABP框架,那时候还是比较笨重的旧版本的,后来升级到vNext版本,我也基于ABP模块化的设计方式开发了一些模块用于日常工作。这个系列主要为了系统地记录一下日常工作与学习中的关于ABP的一些知识点。章节目录初始ABPABP-模块加载机制ABP-依赖注入(......