-
Notifications
You must be signed in to change notification settings - Fork 153
45 lines (41 loc) · 1.47 KB
/
cd_winget.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
name: Publish to WinGet
on:
release:
types: [released]
jobs:
check-release:
runs-on: ubuntu-latest
outputs:
valid-cli: ${{ steps.cli-name.outputs.valid }}
cli-vsn: ${{ steps.cli-name.outputs.cli-vsn }}
steps:
- name: Confirm that this is the release of ipinfo cli
id: cli-name
run: |
releaseName="${{ github.event.release.name }}"
if [[ $releaseName =~ ^ipinfo-([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
echo "Release name matches pattern 'ipinfo-x.x.x'"
echo "cli-vsn=${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${BASH_REMATCH[3]}" >> "$GITHUB_OUTPUT"
echo "valid=true" >> "$GITHUB_OUTPUT"
else
echo "Invalid release name format: $releaseName"
echo "Release name should be of format ipinfo-x.x.x"
fi
publish:
needs: check-release
if: needs.check-release.outputs.valid-cli == 'true'
runs-on: windows-latest
steps:
- name: Get Github App Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.G_APP_ID }}
private-key: ${{ secrets.G_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- uses: vedantmgoyal2009/winget-releaser@v2
with:
identifier: ipinfo.ipinfo
installers-regex: '_windows_\w+\.zip$'
version: ${{ needs.check-release.outputs.cli-vsn }}
token: ${{ steps.app-token.outputs.token }}