From d64504e897e0b5e220bc5d85a2249aae646d13b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Tsch=C3=A4pp=C3=A4t?= Date: Wed, 17 Aug 2022 18:50:15 +0200 Subject: [PATCH] github action configuration --- .github/labeler.yml | 11 +++ ...lease-changelog-builder-configuration.json | 7 ++ .github/workflows/Pull-Request-Labeler.yml | 14 +++ .github/workflows/Pull-Request.yml | 19 ++++ .github/workflows/Push-Dev-Nuget.yml | 21 +++++ .github/workflows/Release.yml | 35 ++++++++ .github/workflows/main.yml | 88 ------------------- IPX800cs.sln | 6 +- 8 files changed, 112 insertions(+), 89 deletions(-) create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/Pull-Request-Labeler.yml create mode 100644 .github/workflows/Pull-Request.yml create mode 100644 .github/workflows/Push-Dev-Nuget.yml create mode 100644 .github/workflows/Release.yml delete mode 100644 .github/workflows/main.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000..d66f1e62 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,11 @@ +feature: + - branch: ['feature/*', 'feat/*'] + +fix: + - branch: ['fix/*', 'hotfix/*'] + +test: + - branch: ['test/*', 'tests/*'] + +dependencies: + - branch: ['dependencies/*', 'deps/*'] \ No newline at end of file diff --git a/.github/release-changelog-builder-configuration.json b/.github/release-changelog-builder-configuration.json index f4d060c9..de456911 100644 --- a/.github/release-changelog-builder-configuration.json +++ b/.github/release-changelog-builder-configuration.json @@ -15,7 +15,14 @@ { "title": "## 📦 Dependencies", "labels": ["dependencies"] + }, + { + "title": "## 💬 Other", + "labels": ["other"] } ], + "ignore_labels": [ + "ignore" + ], "pr_template": "- ${{TITLE}} (#${{NUMBER}})" } \ No newline at end of file diff --git a/.github/workflows/Pull-Request-Labeler.yml b/.github/workflows/Pull-Request-Labeler.yml new file mode 100644 index 00000000..680f9d18 --- /dev/null +++ b/.github/workflows/Pull-Request-Labeler.yml @@ -0,0 +1,14 @@ +name: "Pull Request Labeler" +on: +- pull_request_target + +jobs: + triage: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v4 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/.github/workflows/Pull-Request.yml b/.github/workflows/Pull-Request.yml new file mode 100644 index 00000000..536c702b --- /dev/null +++ b/.github/workflows/Pull-Request.yml @@ -0,0 +1,19 @@ +name: "Pull Request" +on: + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + init: + uses: elendil-software/github-actions/.github/workflows/init-workflow.yml@main + + gitversion: + needs: init + uses: elendil-software/github-actions/.github/workflows/gitversion.yml@main + with: + config: './.github/GitVersion-Release.yml' + + build: + needs: gitversion + uses: elendil-software/github-actions/.github/workflows/dotnet-build.yml@main \ No newline at end of file diff --git a/.github/workflows/Push-Dev-Nuget.yml b/.github/workflows/Push-Dev-Nuget.yml new file mode 100644 index 00000000..fcdbf4e1 --- /dev/null +++ b/.github/workflows/Push-Dev-Nuget.yml @@ -0,0 +1,21 @@ +name: 'Push Developement NuGet' +on: + workflow_dispatch: + +jobs: + init: + uses: elendil-software/github-actions/.github/workflows/init-workflow.yml@main + + gitversion: + needs: init + uses: elendil-software/github-actions/.github/workflows/gitversion.yml@main + with: + config: './.github/GitVersion.yml' + + build: + needs: gitversion + uses: elendil-software/github-actions/.github/workflows/dotnet-build.yml@main + + nuget-push: + needs: build + uses: elendil-software/github-actions/.github/workflows/nuget-push-github.yml@main \ No newline at end of file diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml new file mode 100644 index 00000000..ef08a78e --- /dev/null +++ b/.github/workflows/Release.yml @@ -0,0 +1,35 @@ +name: 'Release' +on: + workflow_dispatch: + +jobs: + init: + uses: elendil-software/github-actions/.github/workflows/init-workflow.yml@main + + gitversion: + needs: init + uses: elendil-software/github-actions/.github/workflows/gitversion.yml@main + with: + config: './.github/GitVersion-Release.yml' + + build: + needs: gitversion + uses: elendil-software/github-actions/.github/workflows/dotnet-build.yml@main + + nuget-push: + needs: build + uses: elendil-software/github-actions/.github/workflows/nuget-push-nugetorg.yml@main + secrets: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + + release: + needs: [gitversion, build] + uses: elendil-software/github-actions/.github/workflows/tag-release.yml@main + with: + git_config_user_email: 'git@elendil.software' + git_config_user_name: ${{ github.repository_owner }} + git_tag: ${{needs.gitversion.outputs.SemVer}} + changelog_builder_configuration: './.github/release-changelog-builder-configuration.json' + release_artifacts: "**/*.nupkg" + secrets: + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 057d3c5a..00000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: Main Workflow - -on: - pull_request: - branches: [ main ] - workflow_dispatch: - inputs: - push-nuget: - description: 'Push NuGet' - required: true - default: 'false' - create-release: - description: 'Create Release' - required: true - default: 'false' - -jobs: - build: - runs-on: windows-2022 - - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Setup GitVersion - run: choco install gitversion.portable - - - name: Add GitHub NuGet Source - if: ${{ github.event.inputs.create-release == 'true' || github.event.inputs.push-nuget == 'true' }} - run: nuget source Add -Name github -Source ${{ env.nuget-url }} -Username ${{ env.nuget-user }} -Password ${{ env.nuget-token }} -StorePasswordInClearText - env: - nuget-url: https://nuget.pkg.github.com/elendil-software/index.json - nuget-token: ${{ secrets.GITHUB_TOKEN }} - nuget-user: ${{ secrets.NUGET_GITHUB_USER }} - - - name: Execute GitVersion - Dev - if: ${{ github.event_name == 'pull_request' || github.event.inputs.create-release == 'false' }} - run: gitversion /config ./.github/GitVersion.yml /output buildserver /updateprojectfiles - - - name: Execute GitVersion - Release - if: ${{ github.event.inputs.create-release == 'true' }} - run: gitversion /config ./.github/GitVersion-Release.yml /output buildserver /updateprojectfiles - - - name: Restore - run: dotnet restore - - - name: Build - run: dotnet build --configuration Release --no-incremental --no-restore - - - name: Test - run: dotnet test --configuration Release --no-restore --verbosity normal - - - name: NuGet Push - if: ${{ github.event.inputs.create-release == 'true' || github.event.inputs.push-nuget == 'true' }} - run: nuget push **/*.nupkg -Source github -ApiKey ${{ env.repo-token }} - env: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Create Tag - if: ${{ github.event.inputs.create-release == 'true' }} - run: | - git config user.email "git@elendil.software" - git config user.name "Elendil Software Workflow" - git tag -a ${{ env.GitVersion_SemVer }} -m "${{ env.GitVersion_SemVer }}" - git push --follow-tags - - - name: Build Changelog - if: ${{ github.event.inputs.create-release == 'true' }} - id: build_changelog - uses: mikepenz/release-changelog-builder-action@v1.7.1 - with: - failOnError: true - configuration: "./.github/release-changelog-builder-configuration.json" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create Release - if: ${{ github.event.inputs.create-release == 'true' }} - uses: ncipollo/release-action@v1 - with: - artifactErrorsFailBuild: true - draft: true - body: "${{steps.build_changelog.outputs.changelog}}" - tag: "${{ env.GitVersion_SemVer }}" - artifacts: "**/*.nupkg,CHANGELOG.md" - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/IPX800cs.sln b/IPX800cs.sln index 27d2aec6..cf8b982b 100644 --- a/IPX800cs.sln +++ b/IPX800cs.sln @@ -21,11 +21,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{9F8B .github\GitVersion.yml = .github\GitVersion.yml .github\GitVersion-Release.yml = .github\GitVersion-Release.yml .github\release-changelog-builder-configuration.json = .github\release-changelog-builder-configuration.json + .github\labeler.yml = .github\labeler.yml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{0D379098-AE02-4E0F-87CB-97BC89C80A28}" ProjectSection(SolutionItems) = preProject - .github\workflows\main.yml = .github\workflows\main.yml + .github\workflows\Release.yml = .github\workflows\Release.yml + .github\workflows\Push-Dev-Nuget.yml = .github\workflows\Push-Dev-Nuget.yml + .github\workflows\Pull-Request-Labeler.yml = .github\workflows\Pull-Request-Labeler.yml + .github\workflows\Pull-Request.yml = .github\workflows\Pull-Request.yml EndProjectSection EndProject Global