Skip to content

Commit 911c324

Browse files
committed
ci: add release workflow with store and social notifications
- Trigger on v* tag push - Build portable and MSIX packages for x64, x86, arm64 - Generate changelog using reusable workflow - Create GitHub release with artifacts - Submit to Microsoft Store (non-prereleases) - Post notifications to Bluesky and LinkedIn
1 parent 07808b2 commit 911c324

File tree

1 file changed

+195
-0
lines changed

1 file changed

+195
-0
lines changed

.github/workflows/release.yml

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
actions: read
11+
12+
env:
13+
PROJECT_PATH: src/CodingWithCalvin.VSToolbox/CodingWithCalvin.VSToolbox.csproj
14+
APP_NAME: VSToolbox
15+
16+
jobs:
17+
changelog:
18+
name: Generate Changelog
19+
uses: CodingWithCalvin/.github/.github/workflows/generate-changelog.yml@main
20+
secrets: inherit
21+
22+
build:
23+
runs-on: windows-latest
24+
25+
strategy:
26+
matrix:
27+
platform: [x64, x86, arm64]
28+
29+
outputs:
30+
version: ${{ steps.version.outputs.VERSION }}
31+
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
36+
- name: Setup .NET
37+
uses: actions/setup-dotnet@v4
38+
with:
39+
dotnet-version: '10.0.x'
40+
41+
- name: Get version from tag
42+
id: version
43+
shell: pwsh
44+
run: |
45+
$tag = "${{ github.ref_name }}"
46+
$version = $tag -replace '^v', ''
47+
echo "VERSION=$version" >> $env:GITHUB_OUTPUT
48+
echo "Version: $version"
49+
50+
- name: Update version in manifest
51+
shell: pwsh
52+
run: |
53+
$manifest = "src/CodingWithCalvin.VSToolbox/Package.appxmanifest"
54+
$content = Get-Content $manifest -Raw
55+
$content = $content -replace 'Version="[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"', "Version=`"${{ steps.version.outputs.VERSION }}.0`""
56+
Set-Content $manifest $content
57+
58+
- name: Restore dependencies
59+
run: dotnet restore ${{ env.PROJECT_PATH }}
60+
61+
# Build portable (self-contained) executable
62+
- name: Build portable
63+
run: |
64+
dotnet publish ${{ env.PROJECT_PATH }} `
65+
--configuration Release `
66+
--runtime win-${{ matrix.platform }} `
67+
--self-contained true `
68+
-p:PublishSingleFile=false `
69+
-p:PublishReadyToRun=true `
70+
-p:PublishTrimmed=true `
71+
-p:Platform=${{ matrix.platform }} `
72+
--output ./artifacts/portable/${{ matrix.platform }}
73+
74+
- name: Zip portable build
75+
shell: pwsh
76+
run: |
77+
Compress-Archive -Path ./artifacts/portable/${{ matrix.platform }}/* -DestinationPath ./artifacts/${{ env.APP_NAME }}-${{ steps.version.outputs.VERSION }}-${{ matrix.platform }}-portable.zip
78+
79+
# Build MSIX package
80+
- name: Build MSIX
81+
run: |
82+
dotnet publish ${{ env.PROJECT_PATH }} `
83+
--configuration Release `
84+
--runtime win-${{ matrix.platform }} `
85+
-p:Platform=${{ matrix.platform }} `
86+
-p:WindowsPackageType=MSIX `
87+
-p:AppxPackageDir=./artifacts/msix/${{ matrix.platform }}/ `
88+
-p:AppxBundle=Never `
89+
-p:UapAppxPackageBuildMode=SideloadOnly `
90+
-p:GenerateAppxPackageOnBuild=true
91+
92+
- name: Find and rename MSIX
93+
shell: pwsh
94+
run: |
95+
$msix = Get-ChildItem -Path ./artifacts/msix/${{ matrix.platform }} -Filter *.msix -Recurse | Select-Object -First 1
96+
if ($msix) {
97+
Copy-Item $msix.FullName "./artifacts/${{ env.APP_NAME }}-${{ steps.version.outputs.VERSION }}-${{ matrix.platform }}.msix"
98+
}
99+
100+
- name: Upload portable artifact
101+
uses: actions/upload-artifact@v4
102+
with:
103+
name: portable-${{ matrix.platform }}
104+
path: ./artifacts/${{ env.APP_NAME }}-${{ steps.version.outputs.VERSION }}-${{ matrix.platform }}-portable.zip
105+
106+
- name: Upload MSIX artifact
107+
uses: actions/upload-artifact@v4
108+
with:
109+
name: msix-${{ matrix.platform }}
110+
path: ./artifacts/${{ env.APP_NAME }}-${{ steps.version.outputs.VERSION }}-${{ matrix.platform }}.msix
111+
if-no-files-found: warn
112+
113+
release:
114+
needs: [changelog, build]
115+
runs-on: ubuntu-latest
116+
outputs:
117+
version: ${{ needs.build.outputs.version }}
118+
119+
steps:
120+
- name: Download all artifacts
121+
uses: actions/download-artifact@v4
122+
with:
123+
path: artifacts
124+
merge-multiple: true
125+
126+
- name: List artifacts
127+
run: ls -la artifacts/
128+
129+
- name: Create GitHub Release
130+
uses: ncipollo/release-action@v1.14.0
131+
with:
132+
artifacts: artifacts/*
133+
body: ${{ needs.changelog.outputs.changelog }}
134+
makeLatest: true
135+
tag: ${{ github.ref_name }}
136+
prerelease: ${{ contains(github.ref_name, '-') }}
137+
138+
store:
139+
needs: [build, release]
140+
runs-on: windows-latest
141+
if: ${{ !contains(github.ref_name, '-') }} # Skip for pre-releases
142+
143+
steps:
144+
- name: Checkout
145+
uses: actions/checkout@v4
146+
147+
- name: Download MSIX artifacts
148+
uses: actions/download-artifact@v4
149+
with:
150+
pattern: msix-*
151+
path: msix-packages
152+
merge-multiple: true
153+
154+
- name: List MSIX packages
155+
shell: pwsh
156+
run: Get-ChildItem -Path msix-packages -Recurse
157+
158+
- name: Submit to Microsoft Store
159+
uses: microsoft/store-submission@v1
160+
with:
161+
command: publish
162+
productId: ${{ secrets.STORE_PRODUCT_ID }}
163+
tenantId: ${{ secrets.AZURE_TENANT_ID }}
164+
clientId: ${{ secrets.AZURE_CLIENT_ID }}
165+
clientSecret: ${{ secrets.AZURE_CLIENT_SECRET }}
166+
packagePath: msix-packages/
167+
168+
notify-bluesky:
169+
needs: [release, store]
170+
if: ${{ !contains(github.ref_name, '-') }}
171+
uses: CodingWithCalvin/.github/.github/workflows/bluesky-post.yml@main
172+
with:
173+
post_text: |
174+
🚀 VSToolbox v${{ needs.release.outputs.version }} has been released!
175+
176+
[Check out the release notes here!](https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }})
177+
178+
Get it from the Microsoft Store or download directly from GitHub!
179+
secrets:
180+
BLUESKY_USERNAME: ${{ secrets.BLUESKY_USERNAME }}
181+
BLUESKY_APP_PASSWORD: ${{ secrets.BLUESKY_APP_PASSWORD }}
182+
183+
notify-linkedin:
184+
needs: [release, store]
185+
if: ${{ !contains(github.ref_name, '-') }}
186+
uses: CodingWithCalvin/.github/.github/workflows/linkedin-post.yml@main
187+
with:
188+
post_text: |
189+
🚀 VSToolbox v${{ needs.release.outputs.version }} has been released!
190+
191+
Check out the release notes here: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}
192+
193+
Get it from the Microsoft Store or download directly from GitHub!
194+
secrets:
195+
LINKEDIN_ACCESS_TOKEN: ${{ secrets.LINKEDIN_ACCESS_TOKEN }}

0 commit comments

Comments
 (0)