Skip to content

Update installer.ps1 #28

Update installer.ps1

Update installer.ps1 #28

Workflow file for this run

name: .NET Build and Package
on:
push:
branches:
- main
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
# Setup .NET SDK
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0'
# Restore dependencies
- name: Restore dependencies
run: dotnet restore Community.PowerToys.Run.Plugin.BitwardenPlugin/Community.PowerToys.Run.Plugin.BitwardenPlugin.csproj
# Build project
- name: Build
run: dotnet build Community.PowerToys.Run.Plugin.BitwardenPlugin/Community.PowerToys.Run.Plugin.BitwardenPlugin.csproj --configuration Release --no-restore
# Publish project
- name: Publish
run: dotnet publish Community.PowerToys.Run.Plugin.BitwardenPlugin/Community.PowerToys.Run.Plugin.BitwardenPlugin.csproj -c Release -o ${{github.workspace}}/out
# Extract version from project.json
- name: Extract version
id: project_version
run: |
$json = Get-Content ${{github.workspace}}/out/project.json | ConvertFrom-Json
echo "PROJECT_VERSION=$($json.Version)" | Out-File -FilePath $Env:GITHUB_ENV -Append
echo "::set-output name=version::$($json.Version)"
# Prepare output directory
- name: Prepare output directory
run: |
$sourceDir = "D:\a\BitwardenPluginPowertoys\BitwardenPluginPowertoys\out"
$targetDir = "D:\a\BitwardenPluginPowertoys\BitwardenPluginPowertoys\out\BitwardenPlugin\BitwardenPlugin"
New-Item -Path $targetDir -ItemType Directory -Force
Get-ChildItem -Path $sourceDir -File | Where-Object { $_.Name -notmatch '^(PowerToys\.Common\.UI\.dll|PowerToys\.ManagedCommon\.dll|PowerToys\.Settings\.UI\.Lib\.dll|Wox\.Infrastructure\.dll|Wox\.Plugin\.dll)$' } | ForEach-Object { Copy-Item $_.FullName -Destination $targetDir }
# Zip the prepared directory
- name: Zip the output directory
run: Compress-Archive -Path ${{github.workspace}}/out/BitwardenPlugin/* -DestinationPath ${{github.workspace}}/out/BitwardenPlugin-${{ steps.project_version.outputs.version }}-x64.zip
# Upload Artifact
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: bitwarden-plugin
path: ${{github.workspace}}/out/BitwardenPlugin-${{ steps.project_version.outputs.version }}-x64.zip
# List output directory contents
- name: List output directory contents
run: dir ${{github.workspace}}/out
# Create Release
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.project_version.outputs.version }}
release_name: Release ${{ steps.project_version.outputs.version }}
draft: false
prerelease: false
# Upload Release Asset
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{github.workspace}}/out/BitwardenPlugin-${{ steps.project_version.outputs.version }}-x64.zip
asset_name: BitwardenPlugin-${{ steps.project_version.outputs.version }}.zip
asset_content_type: application/zip