Skip to content

Deploy Blazor.QrCodeGen #35

Deploy Blazor.QrCodeGen

Deploy Blazor.QrCodeGen #35

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
# force build
name: Deploy Blazor.QrCode
on:
# --Manual run--
workflow_dispatch:
# --Auto run--
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
# env:
# NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
# - name: Pack
# run: dotnet pack ./Blazor.QrCode/Blazor.QrCode.csproj --configuration Release --output ./build
- name: Test
run: dotnet test --no-build --verbosity normal
# - name: Publish nuget
# run: dotnet nuget push ./build/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
# - name: Publish
# run: dotnet publish ./Blazor.QrCode/Blazor.QrCode.csproj -c Release --output ./publish
# - name: Publish to GitHub Packages
# run: dotnet nuget add source https://nuget.pkg.github.com/OWNER/index.json --name github --username OWNER --password ${{ secrets.GITHUB_TOKEN }}
# run: dotnet nuget push ./build/*.nupkg --source github --api-key ${{ secrets.GITHUB_TOKEN }}
# - name: Publish to GitHub
# uses: actions/upload-artifact@v2
# with:
# name: Blazor.QrCode
# path: ./Blazor.QrCode/bin/Debug/
- name: Restore dependencies
run: dotnet restore ./Blazor.QrCode/Blazor.QrCode.csproj
- name: Build nuget
run: dotnet build ./Blazor.QrCode/Blazor.QrCode.csproj --no-restore --configuration Release --output ./publish
# env:
# NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
- name: debug output 1
run: |
echo ${{ github.workspace }}
echo .$GITHUB_RUN_NUMBER
- name: Get version
id: get_version
run: |
$dllPath = ${{ github.workspace }}/Blazor.QrCode/publish/Blazor.QrCode.dll
sudo apt-get install mono-runtime
#$versionInfo = Get-FileVersionInfo -FilePath $dllPath
#$version = $versionInfo.ProductVersion
###version=$(strings $dllPath | grep AssemblyVersion | cut -d' ' -f2)
version=$(monodis --assembly $dllPath | grep Version | cut -d' ' -f2)
echo "::set-output name=version::$version"
- name: Display release name
# empty
run: echo Release v${{ steps.get_version.outputs.version }}
- name: Create release
id: create_release
#uses: actions/create-release@v1
# https://github.com/softprops/action-gh-release
uses: softprops/action-gh-release@v1
env:
#you can’t use ${{ secrets.GITHUB_TOKEN }} as it isn’t allowed to publish releases.
#GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PAT }} # need to create by user
#GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ github.workspace }}/publish/*.nupkg
tag_name: ${{ github.ref_name }}
#release_name: Release ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
# tag_name: ${{ needs.build-dev.outputs.version }}
# release_name: Release ${{ needs.build-dev.outputs.version }}
draft: false
prerelease: true