-
-
Notifications
You must be signed in to change notification settings - Fork 43
144 lines (128 loc) · 5.71 KB
/
push_pull.yaml
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Push vsix artifact pull release and comment
on:
push:
branches:
- master
pull_request:
branches:
- master
types: [opened, synchronize, edited]
env:
CONFIGURATION: Release
VSIX_PROJECT: FineCodeCoverage
jobs:
push-vsix-artifact-pull-release-and-comment:
name: Push vsix artifact pull release and comment
runs-on: windows-2019
steps:
- name: create variables
shell: bash
run: |
echo "SOLN=${{env.VSIX_PROJECT}}.sln" >> $GITHUB_ENV
echo "VSIX=${{github.workspace}}\${{env.VSIX_PROJECT}}\bin\${{env.CONFIGURATION}}\${{env.VSIX_PROJECT}}.vsix" >> $GITHUB_ENV # full path required for vsix publish
echo "VSIX2022=${{github.workspace}}\${{env.VSIX_PROJECT}}2022\bin\${{env.CONFIGURATION}}\${{env.VSIX_PROJECT}}2022.vsix" >> $GITHUB_ENV # full path required for vsix publish
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Determine next version
id: next-version
uses: paulhatch/semantic-version@v4.0.1
with:
short_tags: false
branch: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'HEAD' }}
- name: set up msbuild
uses: microsoft/setup-msbuild@v1.0.2
- name: set up VSTest
uses: darenm/Setup-VSTest@v1
- name: nuget restore
run: nuget restore ${{env.SOLN}}
- name: Set version for Visual Studio Extension
uses: cezarypiatek/VsixVersionAction@1.0
with:
version: ${{steps.next-version.outputs.major}}.${{steps.next-version.outputs.minor}}.${{steps.next-version.outputs.patch}}
vsix-manifest-file: ${{env.VSIX_PROJECT}}\source.extension.vsixmanifest
# want this ${{steps.next-version.outputs.major}}.${{steps.next-version.outputs.minor}}.${{github.run_number}}.${{steps.next-version.outputs.patch}}
# but https://github.com/FortuneN/FineCodeCoverage/issues/178
- name: Set version for Visual Studio Extension 2022
uses: cezarypiatek/VsixVersionAction@1.0
with:
version: ${{steps.next-version.outputs.major}}.${{steps.next-version.outputs.minor}}.${{steps.next-version.outputs.patch}}
vsix-manifest-file: ${{env.VSIX_PROJECT}}2022\source.extension.vsixmanifest
# want this ${{steps.next-version.outputs.major}}.${{steps.next-version.outputs.minor}}.${{github.run_number}}.${{steps.next-version.outputs.patch}}
# but https://github.com/FortuneN/FineCodeCoverage/issues/178
- name: build vsix
run: |
msbuild ${{env.SOLN}} /p:Configuration=${{env.CONFIGURATION}} /p:DeployExtension=False /verbosity:minimal
- name: vs test solution
uses: tonyhallett/vstest-solution-action@v1.0.0
# above are common steps for push and pull
# pull only
- name: upload vsix
if: github.event_name == 'pull_request' && !github.event.pull_request.draft
uses: actions/upload-artifact@v2
with:
name: FineCodeCoverage ( zipped vsix)
path: ${{env.VSIX}}
- name: upload vsix 2022
if: github.event_name == 'pull_request' && !github.event.pull_request.draft
uses: actions/upload-artifact@v2
with:
name: FineCodeCoverage2022 ( zipped vsix)
path: ${{env.VSIX2022}}
# push only
- name: create release
if: github.event_name == 'push'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{steps.next-version.outputs.version_tag}}
release_name: ${{steps.next-version.outputs.version_tag}}
draft: false
prerelease: falses
- name: Update release asset
if: github.event_name == 'push'
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}}
asset_path: ${{env.VSIX}}
asset_name: ${{env.VSIX_PROJECT}}.vsix
asset_content_type: application/zip
- name: Update release asset 2022
if: github.event_name == 'push'
id: upload-release-asset-2022
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{steps.create_release.outputs.upload_url}}
asset_path: ${{env.VSIX2022}}
asset_name: ${{env.VSIX_PROJECT}}2022.vsix
asset_content_type: application/zip
- name: add to marketplace
if: github.event_name == 'push'
uses: mrluje/vs-marketplace-publisher@v2
with:
pat: ${{ secrets.FCC_VS_MARKET_PLACE_PUBLISH_TOKEN }}
manifestPath: ${{github.workspace}}\vs-market-place-manifest.json
vsixPath: ${{env.VSIX}}
- name: add to marketplace 2022
if: github.event_name == 'push'
uses: mrluje/vs-marketplace-publisher@v2
with:
pat: ${{ secrets.FCC_VS_MARKET_PLACE_PUBLISH_TOKEN }}
manifestPath: ${{github.workspace}}\vs-market-place-manifest-2022.json
vsixPath: ${{env.VSIX2022}}
- name: comment - released and added to marketplace
if: github.event_name == 'push'
uses: tonyhallett/addCommentToPullAndIssuesFromPushAction@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
comment: released ${{steps.next-version.outputs.version_tag}} and available on marketplace
addTo: pullandissues