-
Notifications
You must be signed in to change notification settings - Fork 3
110 lines (93 loc) · 3.68 KB
/
main.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
name: vc-build CI
on:
workflow_dispatch:
push:
paths-ignore:
- '.github/**'
- 'docs/**'
- 'build/**'
- 'README.md'
- 'LICENSE'
branches:
[main, dev]
pull_request:
branches:
[dev]
paths-ignore:
- 'docs/**'
- 'README.md'
- 'LICENSE'
jobs:
ci:
runs-on: ubuntu-latest
env:
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
NUGET_KEY: ${{ secrets.NUGET_KEY }}
BLOB_SAS: ${{ secrets.BLOB_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install VirtoCommerce.GlobalTool
run: |
dotnet pack
dotnet tool install -g VirtoCommerce.GlobalTool --add-source ./src/VirtoCommerce.Build/artifacts
- name: Get changelog
id: changelog
uses: VirtoCommerce/vc-github-actions/changelog-generator@master
- name: Get Image Version
uses: VirtoCommerce/vc-github-actions/get-image-version@master
id: image
with:
projectType: "platform"
releaseBranch: "main"
- name: Add version suffix
if: ${{ github.ref != 'refs/heads/main' }}
uses: VirtoCommerce/vc-github-actions/add-version-suffix@master
with:
versionSuffix: ${{ steps.image.outputs.suffix }}
- name: SonarCloud Begin
uses: VirtoCommerce/vc-github-actions/sonar-scanner-begin@master
- name: Build
run: vc-build Compile
- name: Unit Tests
run: vc-build Test -skip
- name: Shelltest
shell: bash
working-directory: shelltests
run: |
sudo apt install shelltestrunner
shelltest .
- name: SonarCloud End
uses: VirtoCommerce/vc-github-actions/sonar-scanner-end@master
- name: Quality Gate
uses: VirtoCommerce/vc-github-actions/sonar-quality-gate@master
with:
login: ${{secrets.SONAR_TOKEN}}
- name: Publish Nuget
if: ${{ (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main') && github.event_name != 'workflow_dispatch' }}
uses: VirtoCommerce/vc-github-actions/publish-nuget@master
- name: Create Release
if: ${{ (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main') && github.event_name != 'workflow_dispatch' }}
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ steps.image.outputs.shortVersion }}
release_name: ${{ steps.image.outputs.shortVersion }}
body: ${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: ${{ github.ref != 'refs/heads/main' }}
- name: Upload Release Asset
if: ${{ (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main') && github.event_name != 'workflow_dispatch' }}
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: artifacts/VirtoCommerce.GlobalTool.${{ steps.image.outputs.shortVersion }}.nupkg
asset_name: VirtoCommerce.GlobalTool.${{ steps.image.outputs.shortVersion }}.nupkg
asset_content_type: application/zip