Skip to content

Commit

Permalink
chore: Added actions
Browse files Browse the repository at this point in the history
  • Loading branch information
linkdotnet committed Mar 17, 2024
1 parent 9aeb6f6 commit d72d392
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "nuget" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
39 changes: 39 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "CodeQL"

on:
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
# * * * * *
- cron: '30 1 * * 0'

jobs:
CodeQL-Build:
runs-on: ubuntu-latest

permissions:
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v4.1.1

- uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: |
8.0.x
- name: Initialize CodeQL
uses: github/codeql-action/init@v3

- name: Autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
77 changes: 77 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Create new Release

on:
workflow_dispatch:
inputs:
versionIncrement:
description: 'The new version. For example: 1.1.0'
required: true
default: ''
prerelease:
description: 'Is this a pre-release?'
type: boolean
required: false
default: false

jobs:
release:
name: Publish new release
runs-on: ubuntu-latest
steps:

- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.NCRONTABPAT }}
persist-credentials: true
fetch-depth: 0

- name: Get changelog entries
id: changelog
uses: mindsers/changelog-reader-action@v2
with:
version: Unreleased
path: ./CHANGELOG.md

- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
- name: Update CHANGELOG file
uses: thomaseizinger/keep-a-changelog-new-release@2.0.0
with:
version: ${{ github.event.inputs.versionIncrement }}

- name: Set git config
run: |
git config --local user.email "linkdotnet@action.com"
git config --local user.name "LinkDotNet Bot"
- name: Commit changes and push changes
run: |
git add CHANGELOG.md
git commit -m "Update Changelog.md for ${{github.event.inputs.versionIncrement}} release"
git push origin main
- name: Create release on GitHub
uses: thomaseizinger/create-release@1.0.0
env:
GITHUB_TOKEN: ${{ secrets.SBPAT }}
with:
tag_name: v${{ github.event.inputs.versionIncrement }}
target_commitish: ${{ env.RELEASE_COMMIT_HASH }}
name: v${{ github.event.inputs.versionIncrement }}
body: ${{ steps.changelog.outputs.changes }}
draft: false
prerelease: ${{ github.event.inputs.prerelease }}

- name: Create release package
run: |
dotnet pack -c RELEASE -p:PackageVersion=${{ github.event.inputs.versionIncrement }} --property:PackageOutputPath=${GITHUB_WORKSPACE}/packages /p:ContinuousIntegrationBuild=true --nologo --include-symbols -p:SymbolPackageFormat=snupkg
- name: Upload to nuget
run: |
dotnet nuget push ${GITHUB_WORKSPACE}/packages/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
dotnet nuget push ${GITHUB_WORKSPACE}/packages/*.snupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
31 changes: 31 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: .NET

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
- name: Setup color
run: |
echo "DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION=1" >> $GITHUB_ENV
echo "TERM=xterm" >> $GITHUB_ENV
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release /p:ContinuousIntegrationBuild=true
- name: Test
run: dotnet test -c Release --no-build
39 changes: 39 additions & 0 deletions .github/workflows/update-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Update release

on:
push:
tags:
- '*'
workflow_dispatch:

jobs:
merge-to-stable:

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4.1.1
with:
token: ${{ secrets.NCRONTABPAT }}
persist-credentials: false
fetch-depth: 0

- name: Set git config
run: |
git config --local user.email "linkdotnet@action.com"
git config --local user.name "LinkDotNet Bot"
- name: Merge main to stable
run: |
git fetch
git checkout stable
git pull
git merge --no-ff -X theirs origin/main -m "Updating to newest release"
- name: Push changes
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.SBPAT }}
branch: stable
force: true

0 comments on commit d72d392

Please sign in to comment.