Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Unity build , and add more CI #88

Merged
merged 3 commits into from
Jan 29, 2024
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
63 changes: 46 additions & 17 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Release

on:
workflow_dispatch:
inputs:
Expand All @@ -9,25 +11,52 @@ on:
required: true
default: false
type: boolean

env:
GIT_TAG: ${{ github.event.inputs.tag }}

jobs:
update-version-number:
uses: ./.github/workflows/update-version-number.yaml
with:
tag: ${{ github.event.inputs.tag }}
dry-run: ${{ fromJson(github.event.inputs.dry-run) }}

build-dotnet:
needs: [update-version-number]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.tag }}
- uses: actions/setup-dotnet@v3
with:
dotnet-version: |
8.0.x
- run: dotnet build -c Release
- run: dotnet test -c Release --no-build
- run: dotnet pack -c Release --no-build -o ./publish
- uses: actions/upload-artifact@v3
with:
name: nuget
path: ./publish
- name: Publish
if: github.event.inputs.dry-run == false
run: nuget push ./publish/*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: |
8.0.x
- run: dotnet build -c Release
- run: dotnet test -c Release --no-build
- run: dotnet pack -c Release --no-build -o ./publish
- uses: actions/upload-artifact@v3
with:
name: nuget
path: ./publish
- name: Publish
if: github.event.inputs.dry-run == 'false'
run: dotnet nuget push ./publish/*.nupkg -s 'https://api.nuget.org/v3/index.json' -k ${{secrets.NUGET_API_KEY}}

create-release:
if: github.event.inputs.dry-run == 'false'
needs: [update-version-number, build-dotnet]
runs-on: ubuntu-latest
permissions:
contents: write
timeout-minutes: 10
steps:
# Create Releases
- uses: softprops/action-gh-release@v1
id: create_release
with:
tag_name: ${{ env.GIT_TAG }}
name: v${{ env.GIT_TAG }}
draft: true
prerelease: false
generate_release_notes: true
36 changes: 35 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,38 @@ jobs:
dotnet-version: |
8.0.x
- run: dotnet build -c Debug
- run: dotnet test -c Debug --no-build
- run: dotnet test -c Debug --no-build

test-unity:
runs-on: ubuntu-latest
strategy:
matrix:
unityVersion:
- 2021.3.34f1
- 2022.2.21f1
- 2022.3.18f1
include:
- unityVersion: 2021.3.34f1
license: UNITY_LICENSE_2021_3
- unityVersion: 2022.2.21f1
license: UNITY_LICENSE_2022_2
- unityVersion: 2022.3.18f1
license: UNITY_LICENSE_2022_3
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: VYaml.Unity/Library
key: Library-VYaml-${{ matrix.unityVersion }}
restore-keys: |
Library-VYaml-
Library-
- uses: game-ci/unity-test-runner@v4
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_LICENSE: ${{ secrets[matrix.license] }}
with:
projectPath: ./VYaml.Unity
githubToken: ${{ secrets.GITHUB_TOKEN }}

113 changes: 113 additions & 0 deletions .github/workflows/update-version-number.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Update Version Number

on:
workflow_dispatch:
inputs:
tag:
description: "git tag you want create. (sample 1.0.0)"
required: true
type: string
dry-run:
description: "true to simularate commit but not push change."
required: true
type: boolean
push-tag:
description: "true = push tag. false = no push tag."
required: false
type: boolean
default: true

workflow_call:
inputs:
tag:
description: "git tag you want create. (sample 1.0.0)"
required: true
type: string
dry-run:
description: "true to simularate commit but not push change."
required: true
type: boolean
push-tag:
description: "true = push tag. false = no push tag."
required: false
type: boolean
default: true
outputs:
sha:
description: "Git commit sha has changed."
value: ${{ jobs.update-packagejson.outputs.sha }}
branch-name:
description: Git branch name created.
value: ${{ jobs.update-packagejson.outputs.branch-name }}
is-branch-created:
description: Indicate is Git branch created or not.
value: ${{ jobs.update-packagejson.outputs.is-branch-created }}

jobs:
update-version-number:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
sha: ${{ steps.commit.outputs.sha }}
branch-name: ${{ steps.configure.outputs.branch-name }}
is-branch-created: ${{ steps.configure.outputs.is-branch-created }}
steps:
- name: Configure Output variables
id: configure
run: |
echo "git-tag=${{ inputs.tag }}" | tee -a "$GITHUB_OUTPUT"
echo "dry-run=${{ inputs.dry-run }}" | tee -a "$GITHUB_OUTPUT"
echo "branch-name=test-release/${{ inputs.tag }}" | tee -a "$GITHUB_OUTPUT"
echo "is-branch-created=${{ inputs.dry-run }}" | tee -a "$GITHUB_OUTPUT"

- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'

- name: Update package.json ${{ steps.configure.outputs.git-tag }}
run: |
ruby -i -pe 'gsub(/"version"\s*:\s*"([\d\.]+)"/, %q{"version": "${{ steps.configure.outputs.git-tag }}"})' VYaml.Unity/Assets/VYaml/package.json

- name: Update Directory.Build.props ${{ steps.configure.outputs.git-tag }}
run: |
ruby -i -pe 'gsub(%r{(<PackageVersion>)[\d\.]+(</PackageVersion>)}, %q{\1${{ steps.configure.outputs.git-tag }}\2})' Directory.Build.props

- name: Update README.md ${{ steps.configure.outputs.git-tag }}
run: |
ruby -i -pe 'gsub(%r{(https://github.com/hadashiA/VYaml.git\?path=VYaml.Unity/Assets/VYaml#)[\d\.]+}, %q{\1${{ steps.configure.outputs.git-tag }}})' README.md

- name: Check update on git
id: check_update
run: git diff --exit-code || echo "changed=1" | tee -a "$GITHUB_OUTPUT"

- name: Commit files
id: commit
if: ${{ steps.check_update.outputs.changed == '1' }}
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "${{ steps.configure.outputs.git-tag }}" -a
echo "sha=$(git rev-parse HEAD)" | tee -a "$GITHUB_OUTPUT"

- name: Create Tag
if: ${{ steps.check_update.outputs.changed == '1' && inputs.push-tag }}
run: git tag ${{ steps.configure.outputs.git-tag }}

- name: Push changes
if: ${{ steps.configure.outputs.dry-run == 'false' && steps.check_update.outputs.changed == '1' }}
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
tags: ${{ inputs.push-tag }}

- name: Push changes (dry-run)
if: ${{ steps.configure.outputs.dry-run == 'true' && steps.check_update.outputs.changed == '1' }}
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: "refs/heads/${{ steps.configure.outputs.branch-name }}"
tags: false
force: true
8 changes: 0 additions & 8 deletions VYaml.Unity/Assets/VYaml/Runtime/Plugins.meta

This file was deleted.

Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading