Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 1 addition & 52 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,7 @@ on:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
# used for [release](https://github.com/bytecodealliance/componentize-dotnet/blob/main/RELEASE.md)
branches: [ "main" ]
inputs:
test-run:
description: 'DryRun: Run the workflow without publishing step'
default: 'true'
required: false

workflow_call:

jobs:
build:
Expand Down Expand Up @@ -48,46 +40,3 @@ jobs:
path: artifacts/*.nupkg
if-no-files-found: error
if: ${{ matrix.dotnet == '8.x' }} # only need one package published https://github.com/actions/upload-artifact?tab=readme-ov-file#not-uploading-to-the-same-artifact

release:
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
name: Release
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4 # needed for the create release step
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: nuget-packages
- name: Extract nuget version
id: extract_version
run: |
ls *.nupkg
version=$(unzip -p ./*SDK*.nupkg '*.nuspec' | grep -oPm1 "(?<=<version>)[^<]+")
echo "Version: $version"
echo "version=$version" >> $GITHUB_OUTPUT
# Publish to https://nuget.org and tag the version on repo if test-run=false
- name: Publish
run: dotnet nuget push ./*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
if: ${{ !inputs.test-run }}
- name: Push version tag
if: ${{ !inputs.test-run }}
env:
TAG: v${{ steps.extract_version.outputs.version }}
run: |
git tag $TAG
git push origin $TAG
- name: Create release
if: ${{ !inputs.test-run }}
run: |
gh release create $TAG --generate-notes --prerelease
env:
GH_TOKEN: ${{ github.token }}
TAG: v${{ steps.extract_version.outputs.version }}
59 changes: 59 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Release
run-name: "Release (Test-Run: ${{ inputs.test-run }})"

on:
workflow_dispatch:
# used for [release](https://github.com/bytecodealliance/componentize-dotnet/blob/main/RELEASE.md)
branches: [ "main" ]
inputs:
test-run:
description: 'DryRun: Run the workflow without publishing step'
default: 'true'
required: false

jobs:
build:
uses: ./.github/workflows/build.yml

release:
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
name: Release
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4 # needed for the create release step
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: nuget-packages
- name: Extract nuget version
id: extract_version
run: |
ls *.nupkg
version=$(unzip -p ./*SDK*.nupkg '*.nuspec' | grep -oPm1 "(?<=<version>)[^<]+")
echo "Version: $version"
echo "version=$version" >> $GITHUB_OUTPUT
# Publish to https://nuget.org and tag the version on repo if test-run=false
- name: Publish
run: dotnet nuget push ./*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
if: ${{ !inputs.test-run }}
- name: Push version tag
if: ${{ !inputs.test-run }}
env:
TAG: v${{ steps.extract_version.outputs.version }}
run: |
git tag $TAG
git push origin $TAG
- name: Create release
if: ${{ !inputs.test-run }}
run: |
gh release create $TAG --generate-notes --prerelease
env:
GH_TOKEN: ${{ github.token }}
TAG: v${{ steps.extract_version.outputs.version }}