Skip to content

Commit b1e9d6e

Browse files
committed
chore: add path filters and use shared publish workflow
- Add path filters to build.yml to prevent unnecessary builds - Use env variables for cleaner file path management - Migrate publish.yml to use shared vsix-publish.yml workflow Note: build.yml retains custom steps for Honeycomb API key injection
1 parent deed549 commit b1e9d6e

2 files changed

Lines changed: 29 additions & 88 deletions

File tree

.github/workflows/build.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
1-
name: 'Build and Deploy'
1+
name: Build
22

33
on:
44
workflow_dispatch:
55
pull_request:
66
types: [opened, reopened]
7+
paths:
8+
- 'src/**'
9+
- '*.slnx'
10+
- '.github/workflows/build.yml'
711
push:
812
branches:
913
- main
14+
paths:
15+
- 'src/**'
16+
- '*.slnx'
17+
- '.github/workflows/build.yml'
18+
19+
env:
20+
PROJECT_PATH: src/CodingWithCalvin.OpenInNotepadPlusPlus/CodingWithCalvin.OpenInNotepadPlusPlus.csproj
21+
OUTPUT_PATH: src/CodingWithCalvin.OpenInNotepadPlusPlus/bin/Release
22+
INFO_FILE: CodingWithCalvin.OpenInNotepadPlusPlus.info
23+
VSIX_FILE: CodingWithCalvin.OpenInNotepadPlusPlus.vsix
1024

1125
jobs:
12-
Release-Build-and-Deploy:
26+
build:
1327
runs-on: windows-latest
1428

1529
steps:
@@ -23,7 +37,6 @@ jobs:
2337
$day = (Get-Date).Day
2438
$version = "$year.$month.$day.${{ github.run_number }}"
2539
echo "version=$version" >> $env:GITHUB_OUTPUT
26-
Write-Host "Generated version: $version"
2740
shell: pwsh
2841

2942
- name: 2. Inject Honeycomb API Key
@@ -34,18 +47,18 @@ jobs:
3447
Set-Content $file $content
3548
shell: pwsh
3649

37-
- name: 3. Building Project
38-
run: dotnet build src/CodingWithCalvin.OpenInNotepadPlusPlus/CodingWithCalvin.OpenInNotepadPlusPlus.csproj -c Release -p:SetVsixVersion=${{ steps.version.outputs.version }}
50+
- name: 3. Build Project
51+
run: dotnet build ${{ env.PROJECT_PATH }} -c Release -p:SetVsixVersion=${{ steps.version.outputs.version }}
3952

4053
- name: 4. Create Information File
4154
uses: jsdaniell/create-json@v1.2.3
4255
with:
43-
name: 'src/CodingWithCalvin.OpenInNotepadPlusPlus/bin/Release/CodingWithCalvin.OpenInNotepadPlusPlus.info'
56+
name: '${{ env.OUTPUT_PATH }}/${{ env.INFO_FILE }}'
4457
json: '{"sha":"${{ github.sha }}", "version":"${{ steps.version.outputs.version }}"}'
4558

46-
- name: 5. Publishing Build Artifact
59+
- name: 5. Upload Artifact
4760
uses: actions/upload-artifact@v4
4861
with:
4962
path: |
50-
src/CodingWithCalvin.OpenInNotepadPlusPlus/bin/Release/CodingWithCalvin.OpenInNotepadPlusPlus.info
51-
src/CodingWithCalvin.OpenInNotepadPlusPlus/bin/Release/CodingWithCalvin.OpenInNotepadPlusPlus.vsix
63+
${{ env.OUTPUT_PATH }}/${{ env.INFO_FILE }}
64+
${{ env.OUTPUT_PATH }}/${{ env.VSIX_FILE }}

.github/workflows/publish.yml

Lines changed: 7 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -8,84 +8,12 @@ permissions:
88
actions: read
99

1010
jobs:
11-
changelog:
12-
name: Generate Changelog
13-
uses: CodingWithCalvin/.github/.github/workflows/generate-changelog.yml@main
14-
secrets: inherit
15-
1611
publish:
17-
needs: changelog
18-
runs-on: windows-latest
19-
outputs:
20-
version: ${{ steps.artifact_manifest.outputs.version }}
21-
steps:
22-
- name: Checkout
23-
uses: actions/checkout@v4
24-
25-
- name: 1. Download artifact
26-
id: download-artifact
27-
uses: dawidd6/action-download-artifact@v6
28-
with:
29-
workflow: build.yml
30-
workflow_conclusion: success
31-
32-
- name: 2. Parse Artifact Manifest
33-
id: artifact_manifest
34-
uses: ActionsTools/read-json-action@main
35-
with:
36-
file_path: ./artifact/CodingWithCalvin.OpenInNotepadPlusPlus.info
37-
38-
- name: 3. Create Tag & Release
39-
uses: ncipollo/release-action@v1.14.0
40-
with:
41-
artifacts: ./artifact/CodingWithCalvin.OpenInNotepadPlusPlus.vsix
42-
body: ${{ needs.changelog.outputs.changelog }}
43-
makeLatest: true
44-
commit: ${{ steps.artifact_manifest.outputs.sha }}
45-
tag: ${{ steps.artifact_manifest.outputs.version }}
46-
47-
- name: 4. Publish Release to Marketplace
48-
if: success()
49-
uses: CodingWithCalvin/GHA-VSMarketplacePublisher@v1
50-
with:
51-
marketplace-pat: ${{ secrets.VS_PAT }}
52-
publish-manifest-path: ./resources/extension.manifest.json
53-
vsix-path: ./artifact/CodingWithCalvin.OpenInNotepadPlusPlus.vsix
54-
55-
notify-bluesky:
56-
name: Post to BlueSky
57-
needs: publish
58-
uses: CodingWithCalvin/.github/.github/workflows/bluesky-post.yml@main
12+
uses: CodingWithCalvin/.github/.github/workflows/vsix-publish.yml@main
5913
with:
60-
post_text: |
61-
🚀 Open in Notepad++ v${{ needs.publish.outputs.version }} for #VisualStudio has been released!
62-
63-
📝 [Release Notes](https://github.com/${{ github.repository }}/releases/tag/${{ needs.publish.outputs.version }})
64-
🛒 [Marketplace](https://marketplace.visualstudio.com/items?itemName=CodingWithCalvin.VS-OpenInNotepadPlusPlus)
65-
66-
#dotnet #visualstudio #vsix #notepadplusplus
67-
embed_url: https://marketplace.visualstudio.com/items?itemName=CodingWithCalvin.VS-OpenInNotepadPlusPlus
68-
embed_title: "Open in Notepad++ v${{ needs.publish.outputs.version }}"
69-
embed_description: "Visual Studio extension to open files in Notepad++"
70-
secrets:
71-
BLUESKY_USERNAME: ${{ secrets.BLUESKY_USERNAME }}
72-
BLUESKY_APP_PASSWORD: ${{ secrets.BLUESKY_APP_PASSWORD }}
73-
74-
notify-linkedin:
75-
name: Post to LinkedIn
76-
needs: publish
77-
uses: CodingWithCalvin/.github/.github/workflows/linkedin-post.yml@main
78-
with:
79-
post_text: |
80-
🚀 Open in Notepad++ v${{ needs.publish.outputs.version }} for Visual Studio has been released!
81-
82-
📝 Release Notes: https://github.com/${{ github.repository }}/releases/tag/${{ needs.publish.outputs.version }}
83-
🛒 Marketplace: https://marketplace.visualstudio.com/items?itemName=CodingWithCalvin.VS-OpenInNotepadPlusPlus
84-
85-
#dotnet #visualstudio #vsix #notepadplusplus
86-
article_url: https://marketplace.visualstudio.com/items?itemName=CodingWithCalvin.VS-OpenInNotepadPlusPlus
87-
article_title: "Open in Notepad++ v${{ needs.publish.outputs.version }}"
88-
article_description: "Visual Studio extension to open files in Notepad++"
89-
secrets:
90-
LINKEDIN_ACCESS_TOKEN: ${{ secrets.LINKEDIN_ACCESS_TOKEN }}
91-
LINKEDIN_CLIENT_ID: ${{ secrets.LINKEDIN_CLIENT_ID }}
14+
extension-name: OpenInNotepadPlusPlus
15+
display-name: 'Open in Notepad++'
16+
marketplace-id: CodingWithCalvin.VS-OpenInNotepadPlusPlus
17+
description: 'Visual Studio extension to open files in Notepad++'
18+
hashtags: '#notepadplusplus'
19+
secrets: inherit

0 commit comments

Comments
 (0)