Skip to content

Commit

Permalink
Merge pull request #1 from MareMare/dev
Browse files Browse the repository at this point in the history
各ワークフローを追加します。
MareMare authored Sep 12, 2022
2 parents 80b8925 + 02f991e commit 2269eb3
Showing 6 changed files with 163 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @MareMare
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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:
# nuget の依存関係を維持します。
- package-ecosystem: "nuget" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
# 日本標準時 (UTC +09:00) に nuget の更新をチェックします。
time: "04:00"
timezone: "Asia/Tokyo"
# レビュー担当者を追加します。
reviewers:
- "MareMare"
# nuget プルリクエストのラベルを指定します。
labels:
- "dependencies"
# バージョン更新のプルリクエストを発行します。
target-branch: "main"
# Allow up to 10 open pull requests for dependencies
open-pull-requests-limit: 10
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: .NET Build & UnitTests

on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- "src/**"
pull_request:
branches: [ main ]
paths:
- "src/**"

jobs:
build-and-test:

strategy:
matrix:
configuration: [ Release ]
include:
- os: windows-latest
osName: Windows

name: 🚀 [${{ matrix.configuration }}] Build and Test on ${{ matrix.osName }}
runs-on: ${{ matrix.os }}
steps:
- name: 🛒 Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: ✨ Set up .NET 6.0
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x

- name: 🚚 Restore dependencies
working-directory: src
run: dotnet restore

- name: 🛠️ Build
working-directory: src
run: dotnet build --configuration $env:Configuration --no-restore
env:
Configuration: ${{ matrix.configuration }}
80 changes: 80 additions & 0 deletions .github/workflows/create-release-and-upload-asset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Create Release and Upload Asset

# https://github.com/actions/upload-release-asset

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
build:
name: Upload Release Asset
runs-on: windows-latest

steps:
- name: 🛒 Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: ✨ Set up .NET 6.0
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x

- name: 🚚 Restore dependencies
working-directory: src
run: dotnet restore

- name: 🛠️ Build
working-directory: src
run: dotnet build --configuration Release --no-restore

- name: 🚀 Publish BackupSqlDatabase
shell: pwsh
run: |
dotnet publish .\src\BackupSqlDatabase\BackupSqlDatabase.csproj --configuration Release --output out\BackupSqlDatabase --runtime win-x64 --self-contained true
rm out\BackupSqlDatabase\*.pdb
Compress-Archive -Path "out\BackupSqlDatabase\*.*" -DestinationPath "out\BackupSqlDatabase-win-x64.zip"
- name: 🚀 Publish RestoreSqlDatabase
shell: pwsh
run: |
dotnet publish .\src\RestoreSqlDatabase\RestoreSqlDatabase.csproj --configuration Release --output out\RestoreSqlDatabase --runtime win-x64 --self-contained true
rm out\RestoreSqlDatabase\*.pdb
Compress-Archive -Path "out\RestoreSqlDatabase\*.*" -DestinationPath "out\RestoreSqlDatabase-win-x64.zip"
- name: 📝 Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
TBD
draft: true
prerelease: true

- name: 🚢 Upload BackupSqlDatabase Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: out\BackupSqlDatabase-win-x64.zip
asset_name: BackupSqlDatabase-win-x64.zip
asset_content_type: application/zip

- name: 🚢 Upload RestoreSqlDatabase Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: out\RestoreSqlDatabase-win-x64.zip
asset_name: RestoreSqlDatabase-win-x64.zip
asset_content_type: application/zip
12 changes: 6 additions & 6 deletions src/BackupSqlDatabase/BackupSqlDatabase.csproj
Original file line number Diff line number Diff line change
@@ -5,11 +5,17 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<PublishReadyToRun>true</PublishReadyToRun>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>

<ItemGroup>
<Content Include="..\appsettings.json" Link="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
</ItemGroup>

@@ -21,10 +27,4 @@
<ProjectReference Include="..\SqlDatabaseToolkit\SqlDatabaseToolkit.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
12 changes: 6 additions & 6 deletions src/RestoreSqlDatabase/RestoreSqlDatabase.csproj
Original file line number Diff line number Diff line change
@@ -5,11 +5,17 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<PublishReadyToRun>true</PublishReadyToRun>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>

<ItemGroup>
<Content Include="..\appsettings.json" Link="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
</ItemGroup>

@@ -21,10 +27,4 @@
<ProjectReference Include="..\SqlDatabaseToolkit\SqlDatabaseToolkit.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>

0 comments on commit 2269eb3

Please sign in to comment.