add license and readme to XIVCalc.Lumina #19
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
name: Package and Publish (NuGet.org) | |
on: | |
push: | |
branches: | |
- main | |
tags-ignore: | |
- '*' # don't loop | |
jobs: | |
tag: | |
runs-on: ubuntu-latest | |
outputs: | |
result: ${{steps.s1.outputs.TAG_RESULT}} | |
steps: | |
- name: Determine Tag | |
id: s1 | |
run: | | |
version=$(echo "${{github.event.head_commit.message}}" | perl -nle 'm/build:\s*([0-9]+.[0-9]+.[0-9]+-?[a-z0-9]*)/; print $1'); | |
if [ -z "$version" ]; | |
then | |
echo "No build version found"; | |
echo "TAG_RESULT=fail" >> $GITHUB_OUTPUT; | |
else | |
export TAG_VERSION=$version; | |
echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_OUTPUT; | |
echo "TAG_RESULT=pass" >> $GITHUB_OUTPUT; | |
fi | |
- name: Create Tag | |
if: steps.s1.outputs.TAG_RESULT == 'pass' | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{ github.token }} | |
script: | | |
github.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "refs/tags/${{steps.s1.outputs.TAG_VERSION}}", | |
sha: context.sha | |
}) | |
publish: | |
runs-on: ubuntu-latest | |
needs: tag | |
if: ${{needs.tag.outputs.result == 'pass' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
- name: Test | |
run: dotnet test --configuration Release --no-build --verbosity normal | |
- name: Package | |
run: dotnet pack --configuration Release --no-build | |
- name: Push package | |
run: dotnet nuget push "**/Release/XIVCalc*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |