Skip to content

Commit

Permalink
Merge pull request #6 from Cysharp/feature/release
Browse files Browse the repository at this point in the history
ci: Cysharp/Actions/.github/workflows/create-release.yaml
  • Loading branch information
mayuki authored Apr 3, 2024
2 parents d069b7d + 8d1ea60 commit 2014cdf
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 27 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/build-canary.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build Canary

on:
workflow_dispatch:

jobs:
build-dotnet:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
- name: "Set VersionSuffix for Preview"
id: version-suffix
run: echo "version=preview.`date '+%Y%m%d-%H%M%S'`+${GITHUB_SHA:0:6}" | tee -a $GITHUB_OUTPUT
- run: dotnet build -c Release
# .csproj included version will be used.
- run: dotnet pack -c Release --no-build --version-suffix "${{ steps.version-suffix.outputs.verseion }}" --include-symbols --include-source -o ./publish
# Upload & Publish
- uses: actions/upload-artifact@master
with:
name: nuget
path: publish
- name: "Push to NuGet.org"
run: dotnet nuget push "$GITHUB_WORKSPACE/publish/*.nupkg" --skip-duplicate -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build-Development
name: Build-Debug

on:
push:
Expand Down
67 changes: 41 additions & 26 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,51 @@
name: Build-Release
name: Build Release

on:
push:
tags:
- v*
workflow_dispatch:
inputs:
tag:
description: "tag: git tag you want create. (sample 1.0.0)"
required: true
dry-run:
description: "dry-run: true will never create release/nuget."
required: true
default: false
type: boolean

jobs:
Release:
if: "contains(github.ref, 'refs/tags')"
update-packagejson:
uses: Cysharp/Actions/.github/workflows/update-packagejson.yaml@main
with:
file-path: |
./Directory.Build.props
tag: ${{ inputs.tag }}
dry-run: ${{ inputs.dry-run }}
push-tag: false

build-dotnet:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
- name: "Set VersionSuffix for Preview"
if: "contains(github.ref, 'refs/tags') && contains(github.ref, 'preview')"
run: |
echo "VERSION_SUFFIX=preview.`date '+%Y%m%d-%H%M%S'`+${GITHUB_SHA:0:6}" >> $GITHUB_ENV
- name: "Get git tag"
if: "contains(github.ref, 'refs/tags')"
run: echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
# Build
- run: dotnet restore
- run: dotnet build -c Release
# Packaging
- name: dotnet pack
run: dotnet pack -c Release --no-build --version-suffix "$(versionSuffix)" -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg --output $GITHUB_WORKSPACE/artifacts
# Upload & Publish
- uses: actions/upload-artifact@master
# pack nuget
- run: dotnet build -c Release -p:Version=${{ inputs.tag }}
- run: dotnet test -c Release --no-build -p:Version=${{ inputs.tag }}
- run: dotnet pack -c Release --no-build -p:Version=${{ inputs.tag }} --include-symbols --include-source -o ./publish
- uses: actions/upload-artifact@v2
with:
name: Packages
path: artifacts
- name: "Push to NuGet.org"
run: |
dotnet nuget push "$GITHUB_WORKSPACE/artifacts/*.nupkg" --skip-duplicate -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json
name: nuget
path: ./publish

# release
create-release:
needs: [update-packagejson, build-dotnet]
uses: Cysharp/Actions/.github/workflows/create-release.yaml@main
with:
commit-id: ${{ needs.update-packagejson.outputs.sha }}
dry-run: ${{ inputs.dry-run }}
tag: ${{ inputs.tag }}
nuget-push: true
unitypackage-upload: false
release-format: 'v{0}'
secrets: inherit

0 comments on commit 2014cdf

Please sign in to comment.