Skip to content

Commit

Permalink
Verify update packages before apply (#138)
Browse files Browse the repository at this point in the history
* Include the MiniSig file in the release

* Fixed spacing

* Add signature to Dev-Builds

* Fix spacing again

* Reformat actions

* Try to use OpenPGP step to sign file

* Allow unsecure commands for signing

* Use shell bash for outputting sig

* Add quotes around multiline var

* Remove relative pathing

* Fix relative pathing again

* Fix path to file to sign

* Try to convince nodejs it is a path

* Use a modified action to sign

* Update action

* Update action

* Update action

* Remove signing from dev builds and sign releases

* Implement checking signature before update

* Auto Updater for publish only

* fix spacing

* Update release.yml

* add spacing

* Fix slash again

* Spacing

* UnSpace

* Make changes compatible with main repo

* Verify that a key is installed

* Show updater status in settings
  • Loading branch information
CarbonNeuron authored Jan 27, 2021
1 parent 79b0bc1 commit 55e6458
Show file tree
Hide file tree
Showing 8 changed files with 408 additions and 181 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: Beta releases

on:
Expand All @@ -15,23 +14,33 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Get Previous tag'

- name: "Get Previous tag"
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@master"

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100

- name: Install dependencies
run: dotnet restore "AUCapture-WPF\AUCapture-WPF.csproj"

- name: Publish
run: |
dotnet publish "AUCapture-WPF\AUCapture-WPF.csproj" -p:PublishProfile=DevProfile -p:AssemblyVersion=${{ steps.previoustag.outputs.tag }}.1
- name: Relocate
run: |
mv AUCapture-WPF\\bin\\Release\\netcoreapp3.1\\publish\\AUCapture-WPF.exe AmongUsCapture.exe
mv AUCapture-WPF\\bin\\Release\\netcoreapp3.1\\publish\\AUCapture-WPF.exe ..\AmongUsCapture-Beta.exe
- name: Zip
run: |
7z a AmongUsCapture-Beta.zip ..\AmongUsCapture-Beta.exe -mx=9
- name: AmongUsCapture-beta
uses: actions/upload-artifact@v2
with:
name: AmongUsCapture-beta
path: AmongUsCapture.exe
path: AmongUsCapture-Beta.zip
55 changes: 40 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: goreleaser
on:
push:
tags:
- '*'
- "*"

jobs:
goreleaser:
Expand All @@ -13,35 +13,51 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100
- name: 'Get Previous tag'

- name: "Get Previous tag"
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@master"

- name: Install dependencies
run: dotnet restore "AUCapture-WPF\AUCapture-WPF.csproj"
- name: Publish
run: |
dotnet publish "AUCapture-WPF\AUCapture-WPF.csproj" -p:PublishProfile=PubProfile -p:AssemblyVersion=${{ steps.previoustag.outputs.tag }}.0
- name: Relocate
run: |
mv AUCapture-WPF\\bin\\Release\\netcoreapp3.1\\publish\\AUCapture-WPF.exe ..\AmongUsCapture.exe
- name: Zip
run: |
7z a ..\AmongUsCapture.zip ..\AmongUsCapture.exe -mx=9
- name: Sign
uses: carbonneuron/GHActionSignHash@v4
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
id: sign
with:
path: ../AmongUsCapture.zip
key: ${{ secrets.PRIVATE_KEY }}
privateKey: ${{ secrets.PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}

- name: Output Signature
shell: bash
run: |
echo "${{ steps.sign.outputs.encrypted-text }}" > ../AmongUsCapture.zip.sha256.pgp
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -52,20 +68,29 @@ jobs:
release_name: ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset

- name: Upload capture zip
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ..\AmongUsCapture.zip
asset_name: AmongUsCapture.zip
asset_content_type: application/zip

-
name: Run GoReleaser
- name: Upload capture zip signature
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ..\AmongUsCapture.zip.sha256.pgp
asset_name: AmongUsCapture.zip.sha256.pgp
asset_content_type: text/plain

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
Expand Down
6 changes: 6 additions & 0 deletions AUCapture-WPF/AUCapture-WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
</PropertyGroup>

<ItemGroup>
<None Remove="Resources\AutoMuteUs_PK.asc" />
<None Remove="Icon.ico" />
<None Remove="Resources\Hats\103-1.png" />
<None Remove="Resources\Misc\status-connected.png" />
Expand All @@ -53,6 +54,10 @@
<None Remove="SplashScreens\SplashScreenMonke.png" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Resources\AutoMuteUs_PK.asc" />
</ItemGroup>

<ItemGroup>
<TrimmerRootAssembly Include="System.Runtime" />
<TrimmerRootAssembly Include="System.Runtime.Extensions" />
Expand All @@ -69,6 +74,7 @@
<PackageReference Include="MahApps.Metro" Version="2.4.3" />
<PackageReference Include="NLog" Version="4.7.6" />
<PackageReference Include="Octokit" Version="0.48.0" />
<PackageReference Include="PgpCore" Version="4.0.1" />
<PackageReference Include="SharedMemory" Version="2.2.3" />
<PackageReference Include="WpfScreenHelper" Version="1.0.0" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions AUCapture-WPF/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ protected override void OnStartup(StartupEventArgs e)
default:
throw new ArgumentOutOfRangeException();
}
Console.WriteLine(string.Join(", ",Assembly.GetExecutingAssembly().GetManifestResourceNames())); //Gets all the embedded resources
var r = new Random();
var rValue = r.Next(101);
var goingToPop = rValue <= 3;
Expand Down
3 changes: 3 additions & 0 deletions AUCapture-WPF/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@
<mah:MetroTabItem Header="About">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Orientation="Vertical">
<mah:MetroHeader Header="Auto updater">
<CheckBox IsChecked="{Binding AutoUpdaterEnabled, Mode=OneWay}" IsEnabled="False"/>
</mah:MetroHeader>
<mah:MetroHeader Header="App version:">
<TextBox VerticalAlignment="Center" MinWidth="150" IsReadOnly="True"
Text="{Binding Version, Mode=OneWay}" />
Expand Down
Loading

0 comments on commit 55e6458

Please sign in to comment.