From 6d27c7707c693660e7b97a663bc6aecb44799f58 Mon Sep 17 00:00:00 2001 From: Mark Whitaker Date: Sun, 18 Sep 2022 16:36:36 +0100 Subject: [PATCH] Switch to GitHub Actions (#65) --- .circleci/config.yml | 61 ------------------- .github/workflows/build-and-test.yml | 7 +++ .../build-test-and-publish-release.yml | 10 +++ README.md | 2 +- RegexToolbox.NET.sln | 1 - 5 files changed, 18 insertions(+), 63 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/build-and-test.yml create mode 100644 .github/workflows/build-test-and-publish-release.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index fb34517..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,61 +0,0 @@ -aliases: - - &setup-environment - docker: - - image: mcr.microsoft.com/dotnet/sdk:6.0.201-focal-amd64 - -version: 2 - -jobs: - build: - <<: *setup-environment - steps: - - checkout - - run: - name: Build library - command: - dotnet build -c Release - - run: - name: Run tests - command: - dotnet test -c Release - - deploy-nuget-package: - <<: *setup-environment - steps: - - checkout - - run: - name: Build library (with version) - command: | - ASSEMBLY_VERSION=$(echo $CIRCLE_TAG | sed -e 's/-.*//') - echo CIRCLE_TAG=$CIRCLE_TAG - echo ASSEMBLY_VERSION=$ASSEMBLY_VERSION - dotnet build -c Release /p:Version=$CIRCLE_TAG /p:AssemblyVersion=$ASSEMBLY_VERSION - - run: - name: Build NuGet package - command: - dotnet pack -c Release -o nugetPackage -p:PackageVersion=$CIRCLE_TAG - - deploy: - name: Publish NuGet package - command: - dotnet nuget push nugetPackage/*.nupkg -k $NUGET_API_KEY -s https://api.nuget.org/v3/index.json - - -workflows: - version: 2 - build-and-deploy: - jobs: - - build: - filters: - tags: - only: /.*/ - - deploy-nuget-package: - # Add to PublishToNuGet context to access the NUGET_API_KEY environment variable - context: PublishToNuGet - requires: - - build - filters: - branches: - ignore: /.*/ - tags: - # Only tags beginning x.y.z - only: /^\d+\.\d+\.\d+.*$/ diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..c3be4c1 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,7 @@ +name: Build and test +on: [push, pull_request] + +jobs: + build-and-test: + name: Build and test + uses: markwhitaker/shared-workflows/.github/workflows/dotnet-build-and-test.yml@main diff --git a/.github/workflows/build-test-and-publish-release.yml b/.github/workflows/build-test-and-publish-release.yml new file mode 100644 index 0000000..7b058fb --- /dev/null +++ b/.github/workflows/build-test-and-publish-release.yml @@ -0,0 +1,10 @@ +name: Build, test and publish release +on: + release: + types: [published] + +jobs: + publish-to-nuget: + name: Publish release to NuGet + uses: markwhitaker/shared-workflows/.github/workflows/dotnet-publish-release-to-nuget.yml@main + secrets: inherit diff --git a/README.md b/README.md index d289b7c..ec61410 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![icon](Artwork/RegexToolbox-icon-100.png) -# RegexToolbox.NET [![CircleCI](https://circleci.com/gh/markwhitaker/RegexToolbox.NET.svg?style=shield)](https://circleci.com/gh/markwhitaker/RegexToolbox.NET) [![NuGet Version and Downloads count](https://buildstats.info/nuget/RegexToolbox)](https://www.nuget.org/packages/RegexToolbox/) +# RegexToolbox.NET [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/markwhitaker/RegexToolbox.NET/build-and-test)](https://github.com/markwhitaker/RegexToolbox.NET/actions) [![NuGet Version and Downloads count](https://buildstats.info/nuget/RegexToolbox)](https://www.nuget.org/packages/RegexToolbox/) Regular expression tools for .NET developers. diff --git a/RegexToolbox.NET.sln b/RegexToolbox.NET.sln index 31780d9..a4d5d3c 100644 --- a/RegexToolbox.NET.sln +++ b/RegexToolbox.NET.sln @@ -9,7 +9,6 @@ ProjectSection(SolutionItems) = preProject .gitignore = .gitignore LICENSE = LICENSE README.md = README.md - .circleci\config.yml = .circleci\config.yml EndProjectSection EndProject Global