Skip to content

Commit

Permalink
Simplify workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
christianhelle authored Jan 3, 2024
1 parent dd9ab63 commit e9a0b22
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 72 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ on:
branches:
- '*'

env:
VERSION: 0.1.0.${{ github.run_number }}

jobs:
build:
name: 👌 Verify build
Expand All @@ -30,7 +27,7 @@ jobs:
- name: 🛒 Checkout repository
uses: actions/checkout@v4
- name: 🛠️ Build
run: dotnet build -c Release OasReader.sln -p:UseSourceLink=true -p:PackageVersion="${{ env.VERSION }}" -p:Version="${{ env.VERSION }}"
run: dotnet build -c Release OasReader.sln -p:UseSourceLink=true
- name: 🧪 Test
run: dotnet test OasReader.sln -c Release
- name: 🗳️ Upload
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ on:
branches:
- '*'

env:
VERSION: 0.1.0.${{ github.run_number }}

jobs:
build:
name: 👌 Verify build
Expand All @@ -33,7 +30,7 @@ jobs:
uses: actions/checkout@v4

- name: 🧪 Test
run: dotnet test src/OasReader.Tests/OasReader.Tests.csproj -c Release --collect "Code coverage" -p:UseSourceLink=true -p:PackageVersion="${{ env.VERSION }}"
run: dotnet test src/OasReader.Tests/OasReader.Tests.csproj -c Release --collect "Code coverage" -p:UseSourceLink=true

- name: 🗳️ Upload
uses: actions/upload-artifact@v3
Expand Down
11 changes: 0 additions & 11 deletions .github/workflows/release-preview.yml

This file was deleted.

49 changes: 0 additions & 49 deletions .github/workflows/release-template.yml

This file was deleted.

42 changes: 38 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,43 @@ on:
branches:
- "release"

env:
VERSION: 1.6.11.${{ github.run_number }}

jobs:
publish:
uses: ./.github/workflows/release-template.yml
with:
version: 0.1.0
secrets: inherit
name: 🚚 Prepare new release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Sets environment variables - branch-name
uses: nelonoel/branch-name@v1.0.1
- name: Sets environment variables - Nerdbank.GitVersioning
uses: dotnet/nbgv@master
with:
setAllVars: true
- name: Build
run: dotnet build -c Release OasReader.sln -p:UseSourceLink=true -p:PackageVersion="${{ env.VERSION }}" -p:Version="${{ env.VERSION }}"
- name: Move packages
shell: pwsh
run: Get-ChildItem -Filter *.nupkg -Recurse | ForEach-Object { Move-Item -Path $_ -Destination . }
- name: Publish artifacts
uses: actions/upload-artifact@v3
with:
name: Packages
path: |
**/*.nupkg
README.md
- name: Push packages to NuGet
run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source ${{ env.NUGET_REPO_URL }} --no-symbols
- name: Create tag
uses: actions/github-script@v7
with:
github-token: ${{ github.token }}
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ inputs.version }}",
sha: context.sha
})

0 comments on commit e9a0b22

Please sign in to comment.