Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UF-2015 Add GitHub Workflows #22

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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
registries:
- vippsas-nuget
- nuget-org
directory: "/" # Location of package manifests
schedule:
interval: "daily"
time: "05:00"
open-pull-requests-limit: 5
groups:
dev-dependencies:
patterns:
- "*"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"

registries:
vippsas-nuget:
type: nuget-feed
url: https://nuget.pkg.github.com/vippsas/index.json
username: USERNAME
password: ${{ secrets.READ_GITHUB_PACKAGES_PAT }}
nuget-org:
type: nuget-feed
url: https://api.nuget.org/v3/index.json
39 changes: 39 additions & 0 deletions .github/workflows/build-and-publish-nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build and publish NuGet

on:
push:
branches:
- main

permissions:
contents: read
id-token: write
packages: write

env:
VERSIONNUMBER: 9.12.0

jobs:
Build-and-publish:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

- name: Set up .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Add Vipps NuGet Source
run: dotnet nuget update source GitHub_Nuget --store-password-in-clear-text -u USERNAME -p ${{ secrets.GITHUB_TOKEN }}

- name: Generate build number
id: buildnumber
run: echo "BUILDNUMBER=$((($(date +%s) - $(date -d '2024-01-01' +%s)) / 3600 % 65535))" >> $GITHUB_ENV

- name: Pack
run: dotnet pack --configuration Release /p:Version=${{ env.VERSIONNUMBER }}.${{ env.BUILDNUMBER }}

- name: Push
run: dotnet nuget push ./**/*.nupkg --skip-duplicate --source https://nuget.pkg.github.com/vippsas/index.json --api-key ${{ secrets.GITHUB_TOKEN }}
28 changes: 28 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build and test

on:
pull_request:
branches:
- main

jobs:
build:
name: "Build and test"
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

- name: Set up .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Add Vipps NuGet Source
run: dotnet nuget update source GitHub_Nuget --store-password-in-clear-text -u USERNAME -p ${{ secrets.GITHUB_TOKEN }}

- name: Build
run: dotnet build --configuration Release

- name: Test
run: dotnet test --configuration Release