diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 634ac95..15819ec 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,48 +2,48 @@ name: Publish Package on: push: - branches: - - master + tags: + - 'v*' pull_request: branches: - master permissions: packages: write + contents: read jobs: build: runs-on: [self-hosted, nonroot] - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 # avoid shallow clone so nbgv can do its work. - - name: Inject slug/short variables - uses: rlespinasse/github-slug-action@v4 - with: - prefix: CI_ - - name: Setup .NET - uses: actions/setup-dotnet@v2 - with: - dotnet-version: | - 6.x - 3.1.x - - name: Restore dependencies - run: dotnet restore - - name: Nerdbank.GitVersioning - id: nbgv - uses: dotnet/nbgv@v0.4.1 - - name: Build version (master) - if: env.CI_GITHUB_REF_SLUG == 'master' - run: echo "PUBLISH_VERSION=${{ steps.nbgv.outputs.SimpleVersion }}.${{ steps.nbgv.outputs.VersionHeight }}" >> $GITHUB_ENV - - name: Build version (PR) - if: env.CI_GITHUB_REF_SLUG != 'master' - run: echo "PUBLISH_VERSION=${{ steps.nbgv.outputs.SimpleVersion }}.${{ steps.nbgv.outputs.VersionHeight }}-${{ env.CI_GITHUB_HEAD_REF_SLUG }}" >> $GITHUB_ENV - - name: Build - run: dotnet build --configuration Release -p:Version=${{ env.PUBLISH_VERSION }} --no-restore - - name: Pack - run: dotnet pack --configuration Release --no-build -p:PackageVersion=${{ env.PUBLISH_VERSION }} - - name: Push - run: dotnet nuget push **EPPlus.HTML/bin/Release/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/urbansportsclub/index.json --skip-duplicate --no-symbols + - name: checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 # avoid shallow clone so nbgv can do its work. + - name: Setup .NET + uses: actions/setup-dotnet@v2 + with: + dotnet-version: 6.x + - uses: benjlevesque/short-sha@v1.2 + id: short-sha + with: + length: 7 + - name: set beta metadata (PR) + if: startsWith(github.ref, 'refs/tags/v') != true + run: echo "APPEND=beta-${{ steps.short-sha.outputs.sha }}" >> $GITHUB_ENV + - name: run minver + id: version + uses: Stelzi79/action-minver@3.0.1 + with: + default-pre-release-phase: ${{ env.APPEND }} + tag-prefix: v + minver-version: 4.2.0 + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --configuration Release -p:Version=${{ steps.version.outputs.version }} --no-restore + - name: Pack + run: dotnet pack --configuration Release --no-build -p:Version=${{ steps.version.outputs.version }} + - name: Push + run: dotnet nuget push **EPPlus.HTML/bin/Release/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/urbansportsclub/index.json --skip-duplicate --no-symbols diff --git a/version.json b/version.json deleted file mode 100644 index 45ec9bc..0000000 --- a/version.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.0.0", - "assemblyVersion": { - "precision": "revision" - }, - "publicReleaseRefSpec": [ - "^refs/heads/master$" - ], - "cloudBuild": { - "buildNumber": { - "enabled": true - } - } -} \ No newline at end of file