-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
208 lines (195 loc) · 7.94 KB
/
Copy pathrelease.yml
File metadata and controls
208 lines (195 loc) · 7.94 KB
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: Release
on:
push:
branches:
- main
paths:
- "src/**"
- "packages/**"
- ".github/workflows/**"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}
jobs:
changelog:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.changelog.outputs.version }}
body: ${{ steps.changelog.outputs.clean_changelog }}
tag: ${{ steps.changelog.outputs.tag }}
skipped: ${{ steps.changelog.outputs.skipped }}
steps:
- name: Checkout code 👋
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Create changelog ✍️
id: changelog
uses: TriPSs/conventional-changelog-action@ee43def3241429afddab215ba89090cbf64fb45c
with:
github-token: ${{ secrets.github_token }}
skip-version-file: "true"
output-file: "false"
skip-commit: "true"
skip-on-empty: "true"
skip-tag: "true"
android:
needs: changelog
if: ${{ needs.changelog.outputs.skipped == 'false' }}
runs-on: ubuntu-latest
container: ghcr.io/jandedobbeleer/golang-android-container:latest
steps:
- name: Checkout code 👋
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Build 🏗
run: |
cd src
go build -o dist/posh-android-arm -ldflags="-s -w -X 'github.com/jandedobbeleer/oh-my-posh/src/build.Version=${{ needs.changelog.outputs.version }}' -X 'github.com/jandedobbeleer/oh-my-posh/src/build.Date=$(date)'"
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: android-artifact
path: src/dist/posh-android-arm
artifacts:
needs: changelog
if: ${{ needs.changelog.outputs.skipped == 'false' }}
runs-on: windows-latest
defaults:
run:
shell: pwsh
working-directory: ${{ github.workspace }}/build
steps:
- name: Checkout code 👋
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Install Go 🗳
uses: ./.github/workflows/composite/bootstrap-go
- name: Pre Build 😸
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
run: |
./pre.ps1 -Version ${{ needs.changelog.outputs.version }} -SDKVersion "10.0.26100.0"
- name: Run GoReleaser 🚀
uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94
with:
distribution: goreleaser
version: v2.3.2
args: release --clean --skip publish
workdir: src
env:
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
- name: Package Go module dependencies 📦
working-directory: ${{ github.workspace }}/src
run: |
$env:GOMODCACHE = Join-Path $env:RUNNER_TEMP "gomodcache"
go mod download -modcacherw
New-Item -ItemType Directory -Force -Path dist | Out-Null
tar -acf "dist/oh-my-posh-${{ needs.changelog.outputs.version }}-deps.tar.xz" -C $env:RUNNER_TEMP gomodcache
- name: Post Build 🤐
run: |
./post.ps1
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: build-artifacts
path: |
src/dist/posh-*
src/dist/themes.*
src/dist/checksums.*
src/dist/*-deps.tar.xz
msix:
needs:
- changelog
- artifacts
runs-on: windows-latest
strategy:
matrix:
arch: [x64, arm64]
defaults:
run:
shell: pwsh
working-directory: ${{ github.workspace }}/packages/msix
steps:
- name: Checkout code 👋
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: build-artifacts
path: dist
- name: Build installer 📦
id: build
env:
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
run: |
$version = '${{ needs.changelog.outputs.version }}'.TrimStart("v")
./build.ps1 -Architecture ${{ matrix.arch }} -Version $version -Copy -Sign -SDKVersion "10.0.26100.0"
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: msix-artifact-${{ matrix.arch }}
path: |
packages/msix/out/install-${{ matrix.arch }}.msix
packages/msix/out/install-${{ matrix.arch }}.appinstaller
release:
runs-on: ubuntu-latest
needs:
- changelog
- artifacts
- msix
- android
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
merge-multiple: true
- name: Upload version file
env:
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.CDN_CONNECTIONSTRING }}
run: |
echo v${{ needs.changelog.outputs.version }} > version.txt
az storage blob upload-batch --destination releases/v${{ needs.changelog.outputs.version }} --source .
az storage blob upload-batch --destination releases/v${{ needs.changelog.outputs.version }} --overwrite true --source . --pattern "*.appinstaller" --content-type "application/appinstaller"
az storage blob upload-batch --destination releases/latest --overwrite true --source .
az storage blob upload-batch --destination releases/latest --overwrite true --source . --pattern "*.appinstaller" --content-type "application/appinstaller"
- name: Create draft release 📝
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228
with:
tag_name: ${{ needs.changelog.outputs.tag }}
body: ${{ needs.changelog.outputs.body }}
fail_on_unmatched_files: true
draft: true
token: ${{ secrets.GH_PAT }}
files: |
*
- name: Publish release 🎓
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
run: gh release edit ${{ needs.changelog.outputs.tag }} --draft=false --repo ${{ github.repository }}
winget:
runs-on: windows-latest
needs:
- changelog
- release
env:
WINGETCREATE_TOKEN: ${{ secrets.WINGETCREATE_TOKEN }}
steps:
- name: Create manifest and submit PR 📦
shell: pwsh
run: |
Write-Host "Preparing to submit to WinGet repository..." -ForegroundColor Green
# Install the latest wingetcreate exe
# Need to do things this way, see https://github.com/PowerShell/PowerShell/issues/13138
Write-Verbose "Importing Appx module using Windows PowerShell compatibility"
Import-Module Appx -UseWindowsPowerShell -ErrorAction Stop
# Download and install Winget-Create msixbundle
$appxBundleFile = Join-Path -Path $env:TEMP -ChildPath "wingetcreate.msixbundle"
Write-Verbose "Downloading wingetcreate to: $appxBundleFile"
Invoke-WebRequest -Uri "https://aka.ms/wingetcreate/latest/msixbundle" -OutFile $appxBundleFile -ErrorAction Stop
Add-AppxPackage -Path $appxBundleFile -ErrorAction Stop
Write-Verbose "Successfully installed wingetcreate"
# Submit the PR to WinGet repository
Write-Host "Submitting pull request to WinGet repository..." -ForegroundColor Green
$version = "${{ needs.changelog.outputs.tag }}"
$version = $version.TrimStart('v')
$urls = @(
"https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v$version/install-x64.msix|x64",
"https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v$version/install-arm64.msix|arm64"
)
wingetcreate update JanDeDobbeleer.OhMyPosh --version $version --token $env:WINGETCREATE_TOKEN --submit --urls $urls