Use async callbacks #41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
permissions: | |
actions: write | |
contents: write | |
id-token: write | |
attestations: write | |
on: | |
push: | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
variant: linux-arm | |
- os: ubuntu-latest | |
variant: linux-arm64 | |
- os: ubuntu-latest | |
variant: linux-x64 | |
- os: macos-latest | |
variant: osx-arm64 | |
- os: macos-latest | |
variant: osx-x64 | |
- os: windows-latest | |
variant: win-x64 | |
- os: windows-latest | |
variant: win-x86 | |
- os: windows-latest | |
variant: win-arm64 | |
name: ${{ matrix.variant }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
# Prepare | |
- name: Prepare on Windows | |
if: matrix.os == 'windows-latest' | |
env: | |
STEAM_TOKEN_DUMPER_TOKEN: ${{ secrets.STEAM_TOKEN_DUMPER_TOKEN }} | |
shell: pwsh | |
run: | | |
Set-StrictMode -Version Latest | |
(Get-Content "ApiClient.cs").Replace('@STEAMDB_BUILD_TOKEN@', "$env:STEAM_TOKEN_DUMPER_TOKEN") | Set-Content "ApiClient.cs" | |
- name: Prepare on nix | |
if: matrix.os != 'windows-latest' | |
env: | |
STEAM_TOKEN_DUMPER_TOKEN: ${{ secrets.STEAM_TOKEN_DUMPER_TOKEN }} | |
shell: sh | |
run: | | |
set -eu | |
sed -i'.bak' "s/@STEAMDB_BUILD_TOKEN@/${STEAM_TOKEN_DUMPER_TOKEN}/" "ApiClient.cs" | |
# Publish | |
- name: Publish | |
run: dotnet publish --configuration Release --runtime ${{ matrix.variant }} --self-contained --output bin/SteamTokenDumper SteamTokenDumper.csproj | |
# Archive | |
- name: Prepare archive on Windows | |
if: matrix.os == 'windows-latest' | |
shell: pwsh | |
run: | | |
Set-StrictMode -Version Latest | |
Get-Content LICENSE, release_license.txt | Set-Content bin\SteamTokenDumper\LICENSE.txt | |
- name: Prepare archive on nix | |
if: matrix.os != 'windows-latest' | |
shell: sh | |
run: | | |
set -eu | |
cat LICENSE release_license.txt > bin/SteamTokenDumper/LICENSE.txt | |
# Upload | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: SteamTokenDumper-${{ matrix.variant }} | |
path: bin/SteamTokenDumper | |
# Attest | |
- uses: actions/attest-build-provenance@v1 | |
if: matrix.os == 'windows-latest' | |
with: | |
subject-path: 'bin/SteamTokenDumper/SteamTokenDumper.exe' | |
- uses: actions/attest-build-provenance@v1 | |
if: matrix.os != 'windows-latest' | |
with: | |
subject-path: 'bin/SteamTokenDumper/SteamTokenDumper' | |
release: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Display artifacts folder structure | |
run: ls -Rl | |
working-directory: artifacts | |
- name: Create release files | |
run: | | |
set -eux | |
mkdir release | |
for fileWithPath in artifacts/* | |
do | |
file=$(basename "$fileWithPath") | |
if [[ "$file" =~ "SteamTokenDumper-win" ]] | |
then | |
zip -9 --junk-paths "release/$file.zip" artifacts/$file/* | |
else | |
cd "artifacts/$file/" | |
chmod +x SteamTokenDumper | |
tar --use-compress-program 'gzip -9' --create --verbose --owner=0 --group=0 --file "../../release/$file.tar.gz" -- * | |
cd ../../ | |
fi | |
done | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
draft: true | |
files: release/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |