From 02f991ecd03f25c0c920eb5f305c8b235279470f Mon Sep 17 00:00:00 2001 From: MareMare Date: Mon, 12 Sep 2022 09:57:15 +0900 Subject: [PATCH] =?UTF-8?q?=E5=90=84=E3=83=AF=E3=83=BC=E3=82=AF=E3=83=95?= =?UTF-8?q?=E3=83=AD=E3=83=BC=E3=82=92=E8=BF=BD=E5=8A=A0=E3=81=97=E3=81=BE?= =?UTF-8?q?=E3=81=99=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/CODEOWNERS | 1 + .github/dependabot.yml | 25 ++++++ .github/workflows/ci.yml | 45 +++++++++++ .../create-release-and-upload-asset.yml | 80 +++++++++++++++++++ .../BackupSqlDatabase.csproj | 12 +-- .../RestoreSqlDatabase.csproj | 12 +-- 6 files changed, 163 insertions(+), 12 deletions(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/create-release-and-upload-asset.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..70132d3 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @MareMare diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..b2d99b6 --- /dev/null +++ b/.github/dependabot.yml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..25f5d22 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 }} diff --git a/.github/workflows/create-release-and-upload-asset.yml b/.github/workflows/create-release-and-upload-asset.yml new file mode 100644 index 0000000..c53fc06 --- /dev/null +++ b/.github/workflows/create-release-and-upload-asset.yml @@ -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 diff --git a/src/BackupSqlDatabase/BackupSqlDatabase.csproj b/src/BackupSqlDatabase/BackupSqlDatabase.csproj index f71bd90..7553434 100644 --- a/src/BackupSqlDatabase/BackupSqlDatabase.csproj +++ b/src/BackupSqlDatabase/BackupSqlDatabase.csproj @@ -5,11 +5,17 @@ net6.0 enable enable + true + true + true + true + true Always + true @@ -21,10 +27,4 @@ - - - Always - - - diff --git a/src/RestoreSqlDatabase/RestoreSqlDatabase.csproj b/src/RestoreSqlDatabase/RestoreSqlDatabase.csproj index f71bd90..7553434 100644 --- a/src/RestoreSqlDatabase/RestoreSqlDatabase.csproj +++ b/src/RestoreSqlDatabase/RestoreSqlDatabase.csproj @@ -5,11 +5,17 @@ net6.0 enable enable + true + true + true + true + true Always + true @@ -21,10 +27,4 @@ - - - Always - - -