Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows #93
Workflow file for this run
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: "NuGet" | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
env: | |
NUGET_NAME: "Autofac.Extensions.DependencyInjection.AzureFunctions" | |
NUGET_SOURCE: "https://api.nuget.org/v3/index.json" | |
PACKAGE_PROJECT: "./Autofac.Extensions.DependencyInjection.AzureFunctions/Autofac.Extensions.DependencyInjection.AzureFunctions.csproj" | |
BUILD_PLATFORM: "Any CPU" | |
BUILD_CONFIGURATION: "Release" | |
SHOULD_PUBLISH: ${{ github.ref == 'refs/heads/master' && !contains(github.event.push.commits.*.message, 'readme') }} | |
PUBLISH_DIR: "${{ github.workspace }}/_publish" | |
jobs: | |
build: | |
name: "Build" | |
runs-on: "ubuntu-latest" | |
outputs: | |
PACKAGE_VERSION: ${{ steps.version-number.outputs.PACKAGE_VERSION }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: '3.1.x' | |
- name: "Get Commit Date" | |
uses: actions/[email protected] | |
id: author-date | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const commit_details = await github.git.getCommit({owner: context.repo.owner, repo: context.repo.repo, commit_sha: context.sha}); | |
return commit_details.data.author.date | |
- name: "Set Version Number" | |
id: version-number | |
run: | | |
echo "VERSION_NUMBER=$(date -d ${{ steps.author-date.outputs.result }} +%Y.%m.%d.%H%M)" >> $GITHUB_ENV | |
PACKAGE_VERSION=$(cat "$PACKAGE_PROJECT" | grep -oPm1 "(?<=<PackageVersion>)[^<]+") | |
echo "PACKAGE_VERSION=$PACKAGE_VERSION.${{ github.run_number }}" >> $GITHUB_ENV | |
echo "::set-output name=PACKAGE_VERSION::$PACKAGE_VERSION.${{ github.run_number }}" | |
- name: Setup NuGet | |
uses: NuGet/setup-nuget@v1 | |
with: | |
nuget-version: "latest" | |
nuget-api-key: ${{ secrets.NUGET_KEY }} | |
nuget-api-key-source: ${{ env.NUGET_SOURCE }} | |
- name: NuGet Restore | |
run: nuget restore | |
- name: Build | |
run: dotnet build -p:Configuration="$BUILD_CONFIGURATION" -p:Platform="$BUILD_PLATFORM" -m -p:GeneratePackageOnBuild=true -p:OutDir=$PUBLISH_DIR -p:Version=$VERSION_NUMBER -p:AssemblyVersion=$VERSION_NUMBER -p:AssemblyInformationalVersion=$VERSION_NUMBER -p:PackageVersion=$PACKAGE_VERSION -p:GenerateProjectSpecificOutputFolder=true | |
- uses: actions/upload-artifact@v2 | |
name: Upload artifact | |
if: ${{ env.SHOULD_PUBLISH == 'true' && success() }} | |
with: | |
path: ${{ env.PUBLISH_DIR }}/**/*.nupkg | |
deploy: | |
name: "Deploy" | |
runs-on: "ubuntu-latest" | |
needs: build | |
if: ${{ github.ref == 'refs/heads/master' && !contains(github.event.push.commits.*.message, 'readme') }} | |
environment: | |
name: nuget | |
url: https://www.nuget.org/packages/${{ env.NUGET_NAME }}/${{ needs.build.outputs.PACKAGE_VERSION }} | |
steps: | |
- uses: actions/[email protected] | |
name: Download artifact | |
- name: Publish Package | |
id: "publish" | |
env: | |
NUGET_KEY: ${{ secrets.NUGET_KEY }} # Environment token | |
run: | | |
for f in $(find ./ -name '*.nupkg'); do | |
echo "Pushing $f..."; | |
nuget push "$f" -NonInteractive -Source "$NUGET_SOURCE" -ApiKey $NUGET_KEY; | |
done; | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: "v${{ needs.build.outputs.PACKAGE_VERSION }}" | |
release_name: ${{ needs.build.outputs.PACKAGE_VERSION }} | |
body: | | |
Changes in this [Release](https://www.nuget.org/packages/${{ env.NUGET_NAME }}/${{ needs.build.outputs.PACKAGE_VERSION }}) | |
${{ github.event.head_commit.message }} | |
draft: false | |
prerelease: false |