-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from deanmarcussen/dm/initial-actions
GitHub Actions
- Loading branch information
Showing
3 changed files
with
130 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: build | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 5.0.* | ||
- name: Install dependencies | ||
run: dotnet restore -p:NuGetBuild=True | ||
- name: Build | ||
run: dotnet build --configuration Release --no-restore -p:NuGetBuild=True -p:LangVersion=Latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: publish | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
source: | ||
required: false | ||
type: string | ||
secrets: | ||
apikey: | ||
required: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: haya14busa/action-cond@v1 | ||
id: sourceeval | ||
with: | ||
cond: ${{ inputs.source == '' }} | ||
# default nuget source. TODO change to nuget.org | ||
if_true: "https://nuget.cloudsmith.io/lombiq/open-source-orchard-core-extensions/v3/index.json" | ||
if_false: "${{ inputs.source == '' }}" | ||
- name: Print source | ||
run: echo Nuget Source:${{ steps.sourceeval.outputs.value }} | ||
- name: Get the version | ||
id: get_version | ||
run: | | ||
VERSION="${GITHUB_REF_NAME//v}" | ||
echo VERSION:${VERSION} | ||
echo ::set-output name=VERSION::${VERSION} | ||
- uses: actions/checkout@v2 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 5.0.* | ||
- name: Install dependencies | ||
run: dotnet restore -p:NuGetBuild=True | ||
- name: Build | ||
run: dotnet build --configuration Release --no-restore -p:NuGetBuild=True -p:LangVersion=Latest | ||
- name: Pack | ||
run: dotnet pack --output artifacts --configuration Release --no-restore --no-build -p:NuGetBuild=True -p:Version=${{ steps.get_version.outputs.VERSION }} -p:NoWarn=NU5104 -p:TreatWarningsAsErrors=true | ||
- name: Push with dotnet | ||
run: dotnet nuget push artifacts/*.nupkg --api-key ${{ secrets.apikey }} --source ${{ steps.sourceeval.outputs.value }} --skip-duplicate | ||
- name: Archive artifacts | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: artifacts | ||
path: artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,77 @@ | ||
# Lombiq <add project name here> | ||
# Lombiq NuGet Publishing Github Actions | ||
|
||
|
||
|
||
## About | ||
|
||
Add a general overview of the project here. Don't forget to update the year in the Licence! Keep or remove the OSOCE note below as necessary. | ||
|
||
Do you want to quickly try out this project and see it in action? Check it out in our [Open-Source Orchard Core Extensions](https://github.com/Lombiq/Open-Source-Orchard-Core-Extensions) full Orchard Core solution and also see our other useful Orchard Core-related open-source projects! | ||
Github Actions shared between Lombiq projects, used to publish packages to NuGet. | ||
|
||
|
||
## Documentation | ||
|
||
Add detailed documentation here. If it's a lot of content then create documentation pages under the *Docs* folder and link pages here. | ||
This includes two workflows that can be invoked through the `call-build-workflow` step: | ||
|
||
- _build.yml_: Builds the project with the .NET SDK. | ||
- _publish.yml_: Builds the project with the .NET SDK and publishes it as a NuGet package to the configured NuGet feed. | ||
|
||
To add to a project create a folder from the root of the repository that will call these actions, _.github/workflows/build.yml_ and/or _.github/workflows/publish.yml_. | ||
|
||
Example _build.yml_: | ||
|
||
```yaml | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: [dev] | ||
paths-ignore: | ||
- "Docs/**" | ||
- "Readme.md" | ||
|
||
pull_request: | ||
branches: [dev] | ||
|
||
jobs: | ||
call-build-workflow: | ||
uses: Lombiq/NuGet-Publishing-GitHub-Actions/.github/workflows/build.yml@v1 | ||
``` | ||
This workflow is triggered on push to `dev` and pull requests to `dev` and invokes the _build.yml_ workflow from this repository. It takes no parameters. | ||
|
||
Example _publish.yml_: | ||
|
||
```yaml | ||
name: publish | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
jobs: | ||
call-publish-workflow: | ||
uses: Lombiq/NuGet-Publishing-GitHub-Actions/.github/workflows/publish.yml@v1 | ||
secrets: | ||
apikey: ${{ secrets.LOMBIQ_NUGET_PUBLISH_API_KEY }} | ||
``` | ||
|
||
The _publish.yml_ workflow is triggered on a tag pushed to any branch with the prefix `v` and should contain a version number, e.g. `v1.0.1`, which will be extracted and used to version the NuGet packages produced. | ||
|
||
It takes one non-optional secret parameter, `apikey`, the organization API key for pushing to NuGet, and one optional parameter, `source`: | ||
|
||
```yaml | ||
uses: Lombiq/NuGet-Publishing-GitHub-Actions/.github/workflows/publish.yml@v1 | ||
with: | ||
source: `custom-nuget-source-to-push-too` | ||
``` | ||
|
||
When `source` is not provided, it assumes a default value of pushing to the [Lombiq NuGet feed](https://www.nuget.org/profiles/Lombiq). | ||
|
||
Refer to [Github Actions reusable workflows](https://docs.github.com/en/actions/learn-github-actions/reusing-workflows#overview) for more information. | ||
|
||
|
||
## Contributing and support | ||
|
||
Bug reports, feature requests, comments, questions, code contributions, and love letters are warmly welcome, please do so via GitHub issues and pull requests. Please adhere to our [open-source guidelines](https://lombiq.com/open-source-guidelines) while doing so. | ||
|
||
This project is developed by [Lombiq Technologies](https://lombiq.com/). Commercial-grade support is available through Lombiq. | ||
This project is developed by [Lombiq Technologies](https://lombiq.com/). Commercial-grade support is available through Lombiq. |