Skip to content

Bump actions/upload-artifact from 4.6.2 to 7.0.1 #41

Bump actions/upload-artifact from 4.6.2 to 7.0.1

Bump actions/upload-artifact from 4.6.2 to 7.0.1 #41

Workflow file for this run

name: .NET
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
fetch-depth: 0 # so that NerdBank.GitVersioning has access to history
- name: Setup .NET
uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0
with:
dotnet-version: 9.0.x
- name: Build
run: dotnet build
- name: Test
run: dotnet test
nuget-pack:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
fetch-depth: 0 # so that NerdBank.GitVersioning has access to history
- name: Setup .NET
uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0
with:
dotnet-version: 9.0.x
- name: Build
run: dotnet build --configuration Release
- name: Pack
run: dotnet pack --configuration Release
- name: Upload NuGet artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: nuget-package
path: TypeEquality/bin/Release/TypeEquality.*.nupkg
expected-pack:
needs: [nuget-pack]
runs-on: ubuntu-latest
steps:
- name: Download NuGet artifact
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
name: nuget-package
- name: Check NuGet contents
# Verify that there is exactly one TypeEquality.*.nupkg in the artifact that would be NuGet published
run: if [[ $(find . -maxdepth 1 -name 'TypeEquality.*.nupkg' -printf c | wc -c) -ne "1" ]]; then exit 1; fi
all-required-checks-complete:
needs: [build, expected-pack, github-release-dry-run]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- uses: G-Research/common-actions/check-required-lite@b6771a9cc351238f2964b3a2801aa655d72afcc4 # main
with:
needs-context: ${{ toJSON(needs) }}
nuget-publish:
runs-on: ubuntu-latest
if: ${{ !github.event.repository.fork && github.ref == 'refs/heads/master' }}
needs: [all-required-checks-complete]
environment: release
permissions:
id-token: write
attestations: write
contents: read
steps:
- name: Download NuGet artifact
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
name: nuget-package
path: downloaded
- name: Obtain NuGet key
uses: NuGet/login@d22cc5f58ff5b88bf9bd452535b4335137e24544 # v1.1.0
id: login
with:
user: ${{ secrets.NUGET_USER }}
- name: Publish NuGet package
uses: G-Research/common-actions/publish-nuget@b6771a9cc351238f2964b3a2801aa655d72afcc4 # main
with:
package-name: TypeEquality
nuget-key: ${{ steps.login.outputs.NUGET_API_KEY }}
nupkg-dir: downloaded
github-release:
runs-on: ubuntu-latest
if: ${{ !github.event.repository.fork && github.ref == 'refs/heads/master' }}
needs: [all-required-checks-complete]
environment: release
permissions:
contents: write
steps:
- name: Download NuGet artifact
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
name: nuget-package
path: downloaded
- name: Compute tag
id: compute-tag
run: |
FILE=$(find downloaded -maxdepth 2 -type f -name '*.nupkg' | head -n 1)
TAG=$(basename "$FILE" .nupkg)
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
- name: Generate app token
id: app-token
uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2.2.2
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Create GitHub release
uses: G-Research/common-actions/github-release@b6771a9cc351238f2964b3a2801aa655d72afcc4 # main
with:
tag: ${{ steps.compute-tag.outputs.tag }}
target-commitish: ${{ github.sha }}
github-token: ${{ steps.app-token.outputs.token }}
github-release-dry-run:
runs-on: ubuntu-latest
needs: [nuget-pack]
steps:
- name: Download NuGet artifact
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
name: nuget-package
path: downloaded
- name: Compute tag
id: compute-tag
run: |
FILE=$(find downloaded -maxdepth 2 -type f -name '*.nupkg' | head -n 1)
TAG=$(basename "$FILE" .nupkg)
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
- name: Create GitHub release
uses: G-Research/common-actions/github-release@b6771a9cc351238f2964b3a2801aa655d72afcc4 # main
with:
tag: ${{ steps.compute-tag.outputs.tag }}
target-commitish: ${{ github.sha }}
dry-run: 'true'