-
Notifications
You must be signed in to change notification settings - Fork 1
70 lines (57 loc) · 2.37 KB
/
Copy pathchoco.yml
File metadata and controls
70 lines (57 loc) · 2.37 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
name: Chocolatey
on:
push:
branches:
- master
paths-ignore:
- "art/**"
- "**.md"
jobs:
choco:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- name: Build
run: cargo build --release
- name: Release on chocolatey
run: |
copy target\release\git-open.exe choco\tools\git-open.exe
# Below commands will update the VERFICATION.txt file with the new sha256 of the exe file.
# Unfortunately, CertUtils is not available for PS so we use standard Get-FileHash command.
$sha = ((Get-FileHash choco\tools\git-open.exe | Format-List | findstr Hash) -split ':')[1].trim()
echo "Generated by `CertUtil -hashfile git-open.exe SHA256`:" > choco\tools\VERIFICATION.txt
echo "" >> choco\tools\VERIFICATION.txt
echo $sha >> choco\tools\VERIFICATION.txt
# Below commands will update the nuspec file.
$version = ((Get-Content -Path .\cargo.toml)[3] -split '=')[1].trim().replace('"',"")
$nuspec = (Get-Content -Path choco\git-open.nuspec)
$nuspec[4] = "<version>${version}</version>"
Set-Content -Path choco\git-open.nuspec -Value $nuspec
# Optionally display the outputs
echo $sha
echo $version
echo $nuspec
# Install the cli tool
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco apikey --key ${{ secrets.CHOCOLATEY }} --source https://push.chocolatey.org/
# Create the nupkg
cd choco
choco pack git-open.nuspec
move *.nupkg git-open.nupkg
dir
choco push git-open.nupkg --source https://push.chocolatey.org/
notification:
needs: [choco]
runs-on: ubuntu-latest
steps:
- name: Sending complete notifications
env:
DISCORD_WEBHOOK: ${{ secrets.WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: "{{ EVENT_PAYLOAD.repository.full_name }} - A new package is published on chocolatey."