Merge pull request #73 from Nukem9/main #45
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 publish release' | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
build-and-package: | |
strategy: | |
matrix: | |
platform: ['AnyCPU', 'ARM64'] | |
framework: ['net472-windows'] | |
build_configuration: ['Release', 'Release UWP'] | |
include: | |
- build_configuration: 'Release' | |
uwp_suffix: '-no-uwp' | |
- build_configuration: 'Release UWP' | |
uwp_suffix: '' | |
runs-on: windows-latest | |
permissions: | |
contents: write | |
env: | |
ARTIFACT_ZIP_NAME: 'WireSockUI-${{ github.ref_name }}-${{ matrix.platform }}${{ matrix.uwp_suffix }}' | |
ARTIFACT_SRC_PATH: 'bin/${{ matrix.platform }}/${{ matrix.build_configuration }}/${{ matrix.framework }}/publish/' | |
steps: | |
- name: Checkout from GitHub | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '6.x' | |
- name: Parse Version | |
shell: bash | |
run: | | |
# Strip "v" prefix from tag name | |
WIRESOCKUI_VERSION=$(echo ${{ github.ref_name }} | sed -e 's/^v//') | |
echo "WIRESOCKUI_VERSION=${WIRESOCKUI_VERSION}" >> $GITHUB_ENV | |
- name: Build | |
run: dotnet publish WireSockUI/WireSockUI.csproj --configuration "${{ matrix.build_configuration }}" --framework "${{ matrix.framework }}" --no-self-contained /p:Platform="${{ matrix.platform }}" /p:Version="${{ env.WIRESOCKUI_VERSION }}" /p:Repository="${{ github.repository }}" | |
- name: Create zip archive | |
shell: bash | |
run: | | |
# Exclude .pdb and .winmd files | |
cd "${{ env.ARTIFACT_SRC_PATH }}" | |
7z a -tzip "${{ github.workspace }}/${{ env.ARTIFACT_ZIP_NAME }}.zip" . -xr!*.pdb -xr!*.winmd | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: '${{ env.ARTIFACT_ZIP_NAME }}' | |
path: '${{ env.ARTIFACT_ZIP_NAME }}.zip' | |
if-no-files-found: error | |
upload-release: | |
if: ${{ success() }} | |
needs: build-and-package | |
runs-on: windows-latest | |
steps: | |
- name: Checkout from GitHub | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: 'artifacts' | |
- name: Upload Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: 'artifacts/**/*.zip' | |
name: 'WireSockUI-${{ github.ref_name }}' | |
tag: ${{ github.ref_name }} | |
token: ${{ secrets.MY_GITHUB_PAT }} | |
skipIfReleaseExists: true |