Deploy Blazor.QrCodeGen #43
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
# 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: | |
- name: Checkout files | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- 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 text version from any file | |
# id must be specified to retrieve the output of the step | |
id: version-step | |
uses: michmich112/extract-version@main | |
with: | |
# specify here the path to your version file (e.g. package.json, pom.xml...) | |
##version-file: VERSION | |
##version-file: ${{ github.workspace }}/publish/Blazor.QrCode.dll | |
version-file: ./Blazor.QrCode/Blazor.QrCode.csproj | |
schema: major.minor.build | |
- name: test show version | |
run: | | |
echo "version -> $VERSION" | |
env: | |
VERSION: ${{ steps.version-step.outputs.version }} | |
# - name: Get version 2 | |
# id: get_version | |
# run: | | |
# $dllPath = ${{ github.workspace }}/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 }} | |
run: echo $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: v$VERSION | |
#release_name: Release ${{ github.ref_name }} | |
name: Release v$VERSION | |
# tag_name: ${{ needs.build-dev.outputs.version }} | |
# release_name: Release ${{ needs.build-dev.outputs.version }} | |
draft: false | |
prerelease: false |