build(deps): bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows #46
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: Check Pull-request | |
on: pull_request_target | |
jobs: | |
version: | |
name: Get version | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
changelog: ${{ steps.changelog.outputs.changelog }} | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout all commits, so we get previous tags | |
# The ref and repository is needed since we use on: pull_request_target | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
fetch-depth: 0 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: '16.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Get version | |
id: version | |
env: | |
PR_REF: ${{ github.event.pull_request.head.ref }} | |
run: echo "version=$(npx -q git-conventional-commits version)-${PR_REF}.${{ github.run_number }}" >> $GITHUB_OUTPUT | |
# Generate changelog | |
- name: Get the changelog | |
id: conventional-commits | |
run: npx -q git-conventional-commits changelog --file 'temp_changelog.md' | |
- name: Output changelog | |
id: changelog | |
run: | | |
echo 'changelog<<EOF' >> $GITHUB_OUTPUT | |
cat temp_changelog.md >> $GITHUB_OUTPUT | |
echo 'EOF' >> $GITHUB_OUTPUT | |
test: | |
name: Run unit tests | |
runs-on: ubuntu-latest | |
needs: version | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore --configuration release -p:Version=${{ needs.version.outputs.version }} | |
- name: Test | |
run: dotnet test --no-build --configuration release --logger "trx;LogFileName=test-results.trx" | |
- name: Pack | |
run: dotnet pack --no-build --include-symbols --configuration release -p:PackageVersion=${{ needs.version.outputs.version }} --output ./nugets | |
- name: Upload test-results | |
uses: actions/upload-artifact@v2 | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: test-results | |
path: '**/test-results.trx' | |
- name: Upload package | |
uses: actions/upload-artifact@v2 | |
with: | |
name: package | |
path: '**/*.nupkg' | |
comment: | |
name: Comment on pull-request | |
runs-on: ubuntu-latest | |
needs: version | |
steps: | |
# Create a comment in the pull request using the tags created | |
- uses: marocchino/sticky-pull-request-comment@v1 | |
if: needs.version.outputs.changelog != '' | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
message: | | |
The following versions will be created when this pull-request is merged: | |
${{ needs.version.outputs.changelog }} | |
--- | |
Pre-release package `${{ needs.version.outputs.version }}` can be pushed to nuget | |
- uses: marocchino/sticky-pull-request-comment@v1 | |
if: needs.version.outputs.changelog == '' | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
message: | | |
No packages will be created when this pull-request is merged | |
publish: | |
name: Publish pre-release | |
runs-on: ubuntu-latest | |
environment: pre-release | |
needs: test | |
timeout-minutes: 30 | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: package | |
path: './nuget' | |
- name: Push | |
run: dotnet nuget push "**/*.nupkg" --api-key ${{ secrets.NUGET }} --source https://api.nuget.org/v3/index.json --skip-duplicate |