Skip to content

Update to latest runtime (#104) #174

Update to latest runtime (#104)

Update to latest runtime (#104) #174

Workflow file for this run

# CI/CD pipeline.
name: CICD
on:
workflow_dispatch:
inputs:
version:
description: 'Version number'
required: true
pull_request:
push:
branches: [master, main]
env:
CI: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: 1
jobs:
version:
name: Create a version number
runs-on: ubuntu-22.04
timeout-minutes: 1
outputs:
tag: ${{ steps.create_version.outputs.tag }}
package: ${{ steps.create_version.outputs.package }}
permissions:
contents: 'write'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Create version
id: create_version
uses: degory/create-version@v0.0.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
env:
PRERELEASE: ${{ github.event_name == 'pull_request' }}
build:
name: Build and publish NuGet package
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:8.0
timeout-minutes: 10
needs: [version]
steps:
- uses: actions/checkout@v3
- name: Add GHCR package source
run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/degory/index.json"
- name: Restore local .NET tools
run: dotnet tool restore
- name: Run unit tests
run: dotnet test tests/tests.ghulproj
- name: Run integration tests
run: integration-tests/run-integration-tests.sh
- name: Create package
run: dotnet pack -p:Version=${{ needs.version.outputs.package }}
- name: Upload .NET package artefact
uses: actions/upload-artifact@v4
with:
name: package
path: nupkg
- name: Publish package to GitHub
if: ${{ github.actor != 'dependabot[bot]' }}
run: dotnet nuget push ./nupkg/*.nupkg -k ${GITHUB_TOKEN} -s https://nuget.pkg.github.com/degory/index.json --skip-duplicate --no-symbols
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish package to NuGet
if: ${{ github.event_name == 'push' }}
run: dotnet nuget push ./nupkg/*.nupkg -k ${NUGET_TOKEN} -s https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols
env:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
create_release:
needs: [version, build]
name: Create release
runs-on: ubuntu-20.04
timeout-minutes: 5
if: ${{ github.event_name == 'push' }}
steps:
- uses: actions/checkout@v3
- name: Download package
uses: actions/download-artifact@v4
with:
name: package
path: nupkg
- name: Create changelog
run: git log -1 --format="%s%n%n%b%n%n" >changelog.txt
- name: Create a Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.version.outputs.tag }}
release_name: ${{ needs.version.outputs.tag }}
body_path: changelog.txt
draft: false
- name: Upload package asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./nupkg/ghul.test.${{ needs.version.outputs.package }}.nupkg
asset_name: ghul.test.${{ needs.version.outputs.package }}.nupkg
asset_content_type: application/octet-stream