Skip to content

Commit

Permalink
Merge pull request #8 from Cysharp/feature/actions
Browse files Browse the repository at this point in the history
feat: use Cysharp/Actions reusable workflows/actions
  • Loading branch information
guitarrapc committed Jul 26, 2022
2 parents 2d2cf68 + 61cdfbd commit d76bd32
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 56 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/build-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,14 @@ on:
jobs:
build-dotnet:
runs-on: ubuntu-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
NUGET_XMLDOC_MODE: skip
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1.9.0
- uses: actions/checkout@v3
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
- run: dotnet build src/WebSerializer -c Debug
- run: dotnet test tests/WebSerializer.Tests -c Debug < /dev/null
- run: dotnet build -c Debug
- run: dotnet test -c Debug
46 changes: 14 additions & 32 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,45 @@ on:
tag:
description: "tag: git tag you want create. (sample 1.0.0)"
required: true
dry_run:
description: "dry_run: true will never create relase/nuget."
dry-run:
description: "dry-run: true will never create relase/nuget."
required: true
default: "false"
default: false
type: boolean

env:
GIT_TAG: ${{ github.event.inputs.tag }}
DRY_RUN: ${{ github.event.inputs.dry_run }}
DRY_RUN_BRANCH_PREFIX: "test_release"
DRY_RUN: ${{ github.event.inputs.dry-run }}

jobs:
build-dotnet:
runs-on: ubuntu-latest
timeout-minutes: 10
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
NUGET_XMLDOC_MODE: skip
steps:
- run: echo ${{ needs.update-packagejson.outputs.sha }}
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: ${{ needs.update-packagejson.outputs.sha }}
- uses: actions/setup-dotnet@v1.9.0
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
- run: dotnet build src/WebSerializer -c Release -p:Version=${{ env.GIT_TAG }}
- run: dotnet test tests/WebSerializer.Tests -c Release --no-build
- run: dotnet pack ./src/WebSerializer/WebSerializer.csproj -c Release --no-build -p:Version=${{ env.GIT_TAG }} -o ./publish
- run: dotnet build -c Release -p:Version=${{ env.GIT_TAG }}
- run: dotnet test -c Release --no-build
- run: dotnet pack -c Release --no-build -p:Version=${{ env.GIT_TAG }} -o ./publish
# Store artifacts.
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v2
with:
name: nuget
path: ./publish/

create-release:
if: github.event.inputs.dry_run == 'false'
if: github.event.inputs.dry-run == 'false'
needs: [build-dotnet]
runs-on: ubuntu-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
NUGET_XMLDOC_MODE: skip
timeout-minutes: 10
steps:
# Create Release
- uses: actions/create-release@v1
Expand All @@ -65,17 +58,6 @@ jobs:
draft: true
prerelease: false
# Download (All) Artifacts to current directory
- uses: actions/download-artifact@v2-preview
- uses: actions/download-artifact@v2
# Upload to NuGet
- run: dotnet nuget push "./nuget/*.nupkg" --skip-duplicate -s https://www.nuget.org/api/v2/package -k ${{ secrets.NUGET_KEY }}

cleanup:
if: github.event.inputs.dry_run == 'true'
needs: [build-dotnet]
runs-on: ubuntu-latest
steps:
- name: Delete branch
uses: dawidd6/action-delete-branch@v3
with:
github_token: ${{ github.token }}
branches: ${{ env.DRY_RUN_BRANCH_PREFIX }}-${{ env.GIT_TAG }}
18 changes: 2 additions & 16 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
name: "Close stale issues"

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# enable issue
stale-issue-message: "This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days."
stale-issue-label: "stale"
# enable pr
stale-pr-message: "This PR is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days."
stale-pr-label: "stale"
days-before-stale: 90
days-before-close: 7
exempt-issue-labels: "wip"
exempt-pr-labels: "wip"
remove-stale-when-updated: true
uses: Cysharp/Actions/.github/workflows/stale-issue.yaml@main
1 change: 1 addition & 0 deletions sandbox/Benchmark/Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions sandbox/ConsoleApp/ConsoleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions sandbox/WebApp/WebApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit d76bd32

Please sign in to comment.