diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml new file mode 100644 index 00000000..75eb9e4b --- /dev/null +++ b/.github/workflows/CD.yml @@ -0,0 +1,34 @@ +name: Publish package + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Verify commit exists in origin/main + run: git branch --remote --contains | grep origin/main + - name: Extract release notes + run: | + git log --pretty=format:'%d %s' ${GITHUB_REF} | perl -pe 's| \(.*tag: v(\d+.\d+.\d+(-preview\d{3})?)(, .*?)*\)|\n## \1\n|g' > RELEASE-NOTES + - name: Set VERSION variable from tag + run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV + - name: Pack library + run: dotnet pack src/ConsoleAppVisuals/ConsoleAppVisuals.csproj /p:Version=${VERSION} /p:ContinuousIntegrationBuild=true --output . + env: + GITHUB_ACTIONS: true + GITHUB_ACTION: 'publish' + - name: Push to GitHub Packages + run: dotnet nuget push ConsoleAppVisuals.${VERSION}.nupkg --source https://nuget.pkg.github.com/MorganKryze/index.json --api-key ${GITHUB_TOKEN} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Push to NuGet.org + run: dotnet nuget push ConsoleAppVisuals.${VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 047ac824..ac89bfcd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI and docs +name: Build, test and deploy docs env: ACTIONS_RUNNER_NODE20: true