Skip to content

Commit

Permalink
Update to .NET 9.0 Core
Browse files Browse the repository at this point in the history
  • Loading branch information
Latency committed Apr 9, 2024
1 parent 6e62c9a commit 6df5a85
Show file tree
Hide file tree
Showing 28 changed files with 1,127 additions and 574 deletions.
14 changes: 14 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# These are supported funding model platforms

github: [Latency]
patreon:
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
polar: # Replace with a single Polar username
buy_me_a_coffee: latency
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
76 changes: 76 additions & 0 deletions .github/workflows/delete_workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Delete Workflow Runs
on:
workflow_dispatch:
inputs:
days:
description: 'Days-worth of runs to keep for each workflow'
required: true
default: '30'
minimum_runs:
description: 'Minimum runs to keep for each workflow'
required: true
default: '6'
delete_workflow_pattern:
description: 'Name or filename of the workflow (if not set, all workflows are targeted)'
required: false
delete_workflow_by_state_pattern:
description: 'Filter workflows by state: active, deleted, disabled_fork, disabled_inactivity, disabled_manually'
required: true
default: "ALL"
type: choice
options:
- "ALL"
- active
- deleted
- disabled_inactivity
- disabled_manually
delete_run_by_conclusion_pattern:
description: 'Remove runs based on conclusion: action_required, cancelled, failure, skipped, success'
required: true
default: "ALL"
type: choice
options:
- "ALL"
- "Unsuccessful: action_required,cancelled,failure,skipped"
- action_required
- cancelled
- failure
- skipped
- success
dry_run:
description: 'Dry Run'
default: false
type: boolean
required: false

jobs:
del_runs:
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
steps:
- name: Delete workflow runs
run: |
if [ ${{ github.event.inputs.dry_run }} = true ]; then
echo "DRY_RUN=${{ github.event.inputs.dry_run }}" >> $GITHUB_ENV
else
echo "DRY_RUN=" >> $GITHUB_ENV
fi
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2.0.6
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: ${{ github.event.inputs.days }}
keep_minimum_runs: ${{ github.event.inputs.minimum_runs }}
delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern }}
delete_workflow_by_state_pattern: ${{ github.event.inputs.delete_workflow_by_state_pattern }}
delete_run_by_conclusion_pattern: >-
${{
startsWith(github.event.inputs.delete_run_by_conclusion_pattern, 'Unsuccessful:')
&& 'action_required,cancelled,failure,skipped'
|| github.event.inputs.delete_run_by_conclusion_pattern
}}
dry_run: ${{ env.DRY_RUN }}
58 changes: 58 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: .NET Core Desktop Build
env:
NUGET_SERVER_URL: "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
NUGET_CONFIG: "../NuGet.config"
GH_TOKEN: ${{ secrets.LATENCY_PAT }}

on:
push:
branches: master

pull_request:

workflow_dispatch:

jobs:
build:
if: ${{ startsWith(github.ref, 'refs/tags/') == false }}
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [self-hosted] #, ubuntu-latest, windows-latest]
BuildConfiguration: [ Release ]
max-parallel: 2

steps:

- name: Copy NuGet.Config Template
shell: bash
run: |
cp ../NuGet.Config.template ../NuGet.Config
- name: Update NuGet Config
shell: bash
run: |
nuget config -Set defaultPushSource="${{ env.NUGET_SERVER_URL }}" -ConfigFile ${{ env.NUGET_CONFIG }}
dotnet nuget add source --username ${{ github.repository_owner }} --password ${{ secrets.NUGET_AUTH_TOKEN }} --protocol-version 3 --configfile ${{ env.NUGET_CONFIG }} --store-password-in-clear-text --name github "${{ env.NUGET_SERVER_URL }}"
- uses: actions/checkout@v4.1.1
with:
fetch-depth: '0'

- uses: actions/setup-dotnet@v4.0.0
if: matrix.os != 'self-hosted'
with:
dotnet-version: '8.0.x'
dotnet-quality: 'signed'
source-url: ${{ env.NUGET_SERVER_URL }}
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_AUTH_TOKEN }}

- name: Restore dependencies
run: dotnet restore

- name: Build
id: build
run: |
dotnet build --no-restore --configuration ${{ matrix.BuildConfiguration }}
157 changes: 157 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
name: .NET Core Desktop Release
env:
NUGET_SERVER_URL: "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
GH_TOKEN: ${{ secrets.LATENCY_PAT }}

on:
push:
tags: 'v[0-9]+.[0-9]+.[0-9]+'

workflow_dispatch:

jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5.3.1
with:
skip_after_successful_duplicate: 'true'

release:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ${{ matrix.os }}

permissions:
packages: write
contents: write # write permission is required to create a github release
pull-requests: write # write permission is required for autolabeler otherwise, read permission is required at least

strategy:
matrix:
os: [self-hosted] #, ubuntu-latest, windows-latest]
BuildConfiguration: [ Release ]
max-parallel: 2

steps:

- name: Get PROJECT_NAME
id: project-name
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
split=(${GITHUB_REPOSITORY//\// })
elif [ "$RUNNER_OS" == "Windows" ]; then
split=(${GITHUB_REPOSITORY////// })
else
echo "$RUNNER_OS not supported"
exit 1
fi
index=$((${#split[@]}-1))
project_tag=${split[$index]}
echo "$project_tag"
echo "PROJECT_NAME=$project_tag" >> $GITHUB_ENV
- name: Get README.md Description & PACKAGE_VERSION
id: readme-desc
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
filenames=$(ls ${{ github.workspace }})
elif [ "$RUNNER_OS" == "Windows" ]; then
filenames=$(ls ${GITHUB_WORKSPACE//\//\\ })
else
echo "$RUNNER_OS not supported"
exit 1
fi
for filename in ${filenames[@]}; do
if [ -f $filename -a "$filename" = "README.md" ]; then
desc=$(sed -n '2{P;q;}' $filename | sed 's/\n$//' | sed 's/\r$//' | cut -c 5- )
echo "$desc"
echo "README_DESC=$desc" >> $GITHUB_ENV
regex='\| VERSION:.*-([0-9]+(\.[0-9]+){2,})[-a-z]*'
if [[ $(grep VERSION: $filename) =~ $regex ]]; then
package_version=${BASH_REMATCH[1]}
echo "$package_version"
echo "PACKAGE_VERSION=$package_version" >> $GITHUB_ENV
fi
break
fi
done
- name: Query Release (if exists)
shell: bash
run: |
version=v${{ env.PACKAGE_VERSION }}
cd src
array=$(gh release list -O asc | cut -f3)
cd ..
echo "FIRST_RELEASE=$(echo $array | awk '{print $1}')" >> $GITHUB_ENV
if [[ ${array[@]} =~ $version ]]; then
echo "Release '$version' was found."
echo "RELEASE_FOUND=true" >> $GITHUB_ENV
else
echo "No release exists with version '$version'."
echo "RELEASE_FOUND=false" >> $GITHUB_ENV
fi
- name: Delete Release
if: ${{ env.release_found == 'true' }}
shell: bash
run: |
echo "Deleting current release '$version'"
gh release delete $version --cleanup-tag
env:
release_found: '${{ env.RELEASE_FOUND }}'
version: 'v${{ env.PACKAGE_VERSION }}'

- name: Create Release
shell: bash
run: |
draft=false
prerelease=false
body="${{ env.README_DESC }}
${{ steps.github_release.outputs.changelog }}"
if [ "$draft" = "true" ]; then
d='-d '
fi
if [ "$prerelease" = "true" ]; then
p='-p '
fi
echo "gh release create \"v${{ env.PACKAGE_VERSION }}\" ${p}${d}--generate-notes --notes-start-tag \"${{ env.FIRST_RELEASE }}\" --title \"${{ env.PROJECT_NAME }}\" -n \"$body\""
gh release create "v${{ env.PACKAGE_VERSION }}" ${p}${d}--generate-notes --notes-start-tag "${{ env.FIRST_RELEASE }}" --title "${{ env.PROJECT_NAME }}" -n "$body"
- name: Check If NuGet Package Exists
id: locate-package
shell: bash
run: |
echo "nuget-exists=false" >> $GITHUB_OUTPUT
array=$(nuget search "${{ env.PROJECT_NAME }}" -Source "github" | grep "No results found.\|^>")
if [ "$array" != "No results found." ]; then
ary=($(echo "$array" | grep '^> ' | cut -c 3- | awk '{print $1} {print $3}'))
name=${ary[0]}
version=${ary[1]}
if [ "$name" = "${{ env.PROJECT_NAME }}" -a "$version" = "${{ env.PACKAGE_VERSION }}" ]; then
echo "Package '${{ env.PROJECT_NAME }}.${{ env.PACKAGE_VERSION }}.nupkg' was found to exist."
echo "nuget-exists=true" >> $GITHUB_OUTPUT
fi
fi
- name: Remove Existing NuGet Package
if: ${{ steps.locate-package.outputs.nuget-exists == 'true' }}
#run: dotnet nuget delete ${{ env.PROJECT_NAME }} ${{ env.PACKAGE_VERSION }} --api-key ${{ secrets.NUGET_AUTH_TOKEN }} --non-interactive
uses: actions/delete-package-versions@v5.0.0
with:
owner: ${{ github.repository_owner }}
package-name: ${{ env.PROJECT_NAME }}
package-type: 'nuget'
token: ${{ secrets.NUGET_AUTH_TOKEN }}

- name: Push package to GitHub packages
run: |
dotnet nuget push "D:\Source\Packages\${{ env.PROJECT_NAME }}.${{ env.PACKAGE_VERSION }}.nupkg" -n --skip-duplicate -k ${{ secrets.NUGET_AUTH_TOKEN }}

0 comments on commit 6df5a85

Please sign in to comment.