-
Notifications
You must be signed in to change notification settings - Fork 3
71 lines (60 loc) · 2.3 KB
/
release-artifacts.yml
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
name: Release Artifacts
on:
release:
types: [created]
defaults:
run:
shell: powershell
jobs:
build:
runs-on: windows-latest
permissions: write-all
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Convert tag to version
id: convert_tag
run: |
$version = "${{ github.ref }}"
$version = $version.Replace('refs/tags/', '')
echo "version=$version" >> "$env:GITHUB_ENV"
echo "version=$version"
- name: Set up PowerShell
run: |
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force
- name: Install ps2exe module
run: |
Install-Module -Name ps2exe -Scope CurrentUser -Force
- name: Compile and release scripts
run: |
echo "Compile version ${{ env.version }}"
Get-ChildItem -Path . -Filter '*.ps1' -Recurse -Exclude build-wslinternals.ps1,wsl-dist-update-sched.ps1 | ForEach-Object {
Invoke-ps2exe -inputFile $_.Name -verbose
}
- name: Create archive
run: |
Compress-Archive -Path .\*.exe, .\wsl-dist-update-sched.ps1 -DestinationPath "${{ env.version }}.zip"
- name: Upload executable files
run: |
Get-ChildItem -Path . -Filter *.exe -Recurse | ForEach-Object {
$fileName = $_.Name
$hash = Get-FileHash -Path $_.Name -Algorithm SHA256
$hashLine = "$($hash.Hash.ToLower()) $fileName"
Add-Content -Path "SHA2-256SUMS" -Value $hashLine
gh release upload ${{ env.version }} $fileName --clobber
}
gh release upload ${{ env.version }} SHA2-256SUMS --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload zip file
run: |
Get-ChildItem -Path . -Filter *.zip -Recurse | ForEach-Object {
$fileName = $_.Name
$hash = Get-FileHash -Path $_.Name -Algorithm SHA256
$hashLine = "$($hash.Hash.ToLower()) $fileName"
Add-Content -Path "SHA2-256SUMS" -Value $hashLine
gh release upload ${{ env.version }} $fileName --clobber
}
gh release upload ${{ env.version }} SHA2-256SUMS --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}