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

Update workflows #732

Merged
merged 3 commits into from
Jan 12, 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
7 changes: 6 additions & 1 deletion .github/workflows/build-canary.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
name: build-canary
name: Build Canary

on:
push:
branches:
- main
tags:
- "!*" # not a tag push
paths-ignore:
- **.md
- .github/**
- docs/**
- samples/**
workflow_dispatch:

env:
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/build-debug.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
name: build-debug
name: Build Debug

on:
push:
branches:
- main
tags:
- "!*" # not a tag push
paths-ignore:
- **.md
- .github/**
- docs/**
- samples/**
pull_request:
branches:
- main
paths-ignore:
- **.md
- .github/**
- docs/**
- samples/**

env:
BUILD_CONFIG: Debug
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build-docs
name: Update Docs

on:
push:
Expand Down
57 changes: 1 addition & 56 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build-release
name: Release

on:
workflow_dispatch:
Expand Down Expand Up @@ -72,61 +72,6 @@ jobs:
branch: ${{ env.DRY_RUN_BRANCH_PREFIX }}-${{ env.GIT_TAG }}
tags: false

update-sourcegenerator-unity:
name: Update MagicOnion.Client.SourceGenerator.Unity
needs: [update-packagejson]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- run: echo ${{ needs.update-packagejson.outputs.sha }}
- uses: actions/checkout@v3
with:
ref: ${{ needs.update-packagejson.outputs.sha }}
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
- name: Publish MagicOnion.Client.SourceGenerator.Unity
run: dotnet publish -c ${{ env.BUILD_CONFIG }} ./src/MagicOnion.Client.SourceGenerator.Unity -o ./src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion/MagicOnion.Client/MagicOnion.Client.SourceGenerator.Unity
- name: Remove .deps.json and .pdbs
run: |
rm -f ./src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion/MagicOnion.Client/MagicOnion.Client.SourceGenerator.Unity/*.deps.json
rm -f ./src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion/MagicOnion.Client/MagicOnion.Client.SourceGenerator.Unity/*.pdb

- name: Check update
id: check_update
run: |
git diff --exit-code || echo "::set-output name=changed::1"

- name: Commit files
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 "feat: Update MagicOnion.Client.SourceGenerator.Unity" -a
echo "::set-output name=sha::$(git rev-parse HEAD)"

- name: Check sha
run: echo "SHA ${SHA}"
env:
SHA: ${{ steps.commit.outputs.sha }}

- name: Create Tag
if: steps.check_update.outputs.changed == '1'
run: git tag ${{ env.GIT_TAG }}

- name: Push changes
if: env.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: true

- name: Push changes (dry_run)
if: env.DRY_RUN == 'true' && steps.check_update.outputs.changed == '1'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ env.DRY_RUN_BRANCH_PREFIX }}-${{ env.GIT_TAG }}
tags: false

build-dotnet:
needs: [update-packagejson]
runs-on: ubuntu-latest
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/build-update-sourcegenerator-for-unity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Update pre-built SourceGenerator for Unity

on:
push:
branches:
- main
paths:
- src/MagicOnion.Client.SourceGenerator/**
- src/MagicOnion.Client.SourceGenerator.Unity/**
workflow_dispatch:
inputs:
dry_run:
description: "dry_run: true will never push changes"
required: true
default: "false"

env:
GIT_TAG: ${{ github.event.inputs.tag }}
DRY_RUN: ${{ github.event.inputs.dry_run }}
DRY_RUN_BRANCH_PREFIX: "test_release"
BUILD_CONFIG: Release

jobs:
update-sourcegenerator-unity:
name: Update MagicOnion.Client.SourceGenerator.Unity
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
- name: Publish MagicOnion.Client.SourceGenerator.Unity
run: dotnet publish -c ${{ env.BUILD_CONFIG }} ./src/MagicOnion.Client.SourceGenerator.Unity -o ./src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion/MagicOnion.Client/MagicOnion.Client.SourceGenerator.Unity
- name: Remove .deps.json and .pdbs
run: |
rm -f ./src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion/MagicOnion.Client/MagicOnion.Client.SourceGenerator.Unity/*.deps.json
rm -f ./src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion/MagicOnion.Client/MagicOnion.Client.SourceGenerator.Unity/*.pdb

- name: Check update
id: check_update
run: |
git diff --exit-code || echo "::set-output name=changed::1"

- name: Commit files
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 "feat: Update MagicOnion.Client.SourceGenerator.Unity" -a
echo "::set-output name=sha::$(git rev-parse HEAD)"

- name: Check sha
run: echo "SHA ${SHA}"
env:
SHA: ${{ steps.commit.outputs.sha }}

- name: Create Tag
if: steps.check_update.outputs.changed == '1'
run: git tag ${{ env.GIT_TAG }}

- name: Push changes
if: env.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: true

- name: Push changes (dry_run)
if: env.DRY_RUN == 'true' && steps.check_update.outputs.changed == '1'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ env.DRY_RUN_BRANCH_PREFIX }}-${{ env.GIT_TAG }}
tags: false
2 changes: 1 addition & 1 deletion .github/workflows/prevent-github-change.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Prevent github change
name: Prevent .github change
on:
pull_request:
paths:
Expand Down
5 changes: 4 additions & 1 deletion MagicOnion.sln
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
.github\workflows\build-debug.yml = .github\workflows\build-debug.yml
.github\workflows\build-docs.yml = .github\workflows\build-docs.yml
.github\workflows\build-release.yml = .github\workflows\build-release.yml
.github\workflows\build-update-sourcegenerator-for-unity.yml = .github\workflows\build-update-sourcegenerator-for-unity.yml
.github\workflows\prevent-github-change.yml = .github\workflows\prevent-github-change.yml
.github\workflows\stale.yml = .github\workflows\stale.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{B5617CC1-55FD-4F77-BA75-9450474C6527}"
Expand Down Expand Up @@ -113,7 +116,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagicOnion.Serialization.Me
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagicOnion.Internal", "src\MagicOnion.Internal\MagicOnion.Internal.csproj", "{2996029B-D329-499F-8525-69614A820135}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagicOnion.Serialization.MessagePack.Tests", "tests\MagicOnion.Serialization.MessagePack.Tests\MagicOnion.Serialization.MessagePack.Tests.csproj", "{701E193F-587D-4C20-8970-6E215B0634F8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagicOnion.Serialization.MessagePack.Tests", "tests\MagicOnion.Serialization.MessagePack.Tests\MagicOnion.Serialization.MessagePack.Tests.csproj", "{701E193F-587D-4C20-8970-6E215B0634F8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagicOnion.Abstractions.Tests", "tests\MagicOnion.Abstractions.Tests\MagicOnion.Abstractions.Tests.csproj", "{D340EFB8-128A-4B49-A47A-F00A905D10AC}"
EndProject
Expand Down