Build and package for release #16
Workflow file for this run
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: Build and package for release | |
on: | |
release: | |
types: [published] | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: windows-latest | |
env: | |
PRODUCT_NAME: CanIUse | |
PROJECT_PATH: src/CanIUse/Community.PowerToys.Run.Plugin.CanIUse | |
SLN_PATH: src/CanIUse/CanIUse.sln | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Extract version from release tag | |
id: extract_version | |
run: | | |
$version = '${{ github.event.release.tag_name }}' | |
echo "VERSION=$version" >> $env:GITHUB_ENV | |
shell: powershell | |
- name: Replace version token in plugin.json | |
run: | | |
(Get-Content '${{ env.PROJECT_PATH }}/plugin.json') -replace '\$\(Version\)', '${{ env.VERSION }}' | Set-Content '${{ env.PROJECT_PATH }}/plugin.json' | |
shell: powershell | |
- name: Package | |
run: | | |
dotnet pack ${{ env.SLN_PATH }} -p:Platform=x64 -p:Version=${{ env.VERSION }} | |
dotnet pack ${{ env.SLN_PATH }} -p:Platform=ARM64 -p:Version=${{ env.VERSION }} | |
- name: Upload x64 To Release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{secrets.GITHUB_TOKEN}} | |
file: ${{ env.PROJECT_PATH }}/${{ env.PRODUCT_NAME }}-${{ env.VERSION }}-x64.zip | |
asset_name: ${{ env.PRODUCT_NAME }}-${{ env.VERSION }}-x64.zip | |
- name: Upload ARM64 To Release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{secrets.GITHUB_TOKEN}} | |
file: ${{ env.PROJECT_PATH }}/${{ env.PRODUCT_NAME }}-${{ env.VERSION }}-ARM64.zip | |
asset_name: ${{ env.PRODUCT_NAME }}-${{ env.VERSION }}-ARM64.zip |