Fix README and .editorconfig (#10) #91
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: Module template CI | |
on: | |
workflow_dispatch: | |
inputs: | |
release: | |
type: boolean | |
default: false | |
description: Publish release | |
push: | |
paths-ignore: | |
- '.github/**' | |
- 'docs/**' | |
- 'build/**' | |
- 'README.md' | |
- 'LICENSE' | |
branches: | |
[main, dev] | |
pull_request: | |
branches: | |
[dev] | |
paths-ignore: | |
- 'docs/**' | |
- 'README.md' | |
- 'LICENSE' | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
env: | |
PACKAGE_NAME: 'VirtoCommerce.Module.Template' | |
PACKAGE_VERSION: '1.0-alpha.2' | |
PROJ_PATH: 'VirtoCommerce.ModuleTemplate.csproj' | |
NUGET_NAME: '' | |
NUGET_KEY: ${{ secrets.NUGET_KEY }} | |
FORCE_NUGET: 'false' | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Install VirtoCommerce.GlobalTool | |
run: dotnet tool install --global VirtoCommerce.GlobalTool | |
- name: Get changed files | |
id: changed-files | |
run: | | |
echo '::set-output name=all::$(git show --pretty="" --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | xargs)' | |
- name: Set FORCE_NUGET #Force Nuget publishing if changed version file | |
run: | | |
string=${{ steps.changed-files.outputs.all }} | |
if [[ $string == *"${{ env.PROJ_PATH }}"* ]]; then | |
echo "FORCE_NUGET=true" >> $GITHUB_ENV | |
fi | |
- name: Set FORCE_NUGET #Force Nuget publishing if workflow_dispatch release input checked | |
if: github.event.inputs.release == 'true' && github.event_name == 'workflow_dispatch' | |
run: | | |
echo "FORCE_NUGET=true" >> $GITHUB_ENV | |
- name: Show FORCE_NUGET | |
run: | | |
echo ${{ env.FORCE_NUGET }} | |
- uses: kzrnm/get-net-sdk-project-versions-action@v1 | |
id: get-version | |
with: | |
proj-path: ${{ env.PROJ_PATH }} | |
- name: Set NUGET_NAME variable | |
run: | | |
echo "NUGET_NAME=${{env.PACKAGE_NAME}}.${{steps.get-version.outputs.package-version}}.nupkg" >> $GITHUB_ENV | |
- run: echo "${{env.NUGET_NAME}}" | |
- name: Pack NuGet package | |
run: dotnet pack -o artifacts | |
- name: Install NuGet locally | |
run: | | |
dotnet new -i ./artifacts/${{ env.NUGET_NAME }} | |
- name: Create new module solution from template | |
run: dotnet new vc-module | |
- name: New module test build | |
run: | | |
cd vc-module-new-module | |
vc-build Compile | |
- name: Publish Nuget | |
if: ${{ (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main') && contains( env.FORCE_NUGET, 'true' ) }} | |
run: | | |
dotnet nuget push ./artifacts/${{ env.NUGET_NAME }} --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json | |