Skip to content

Commit

Permalink
更改版本号,增加GitHub Action
Browse files Browse the repository at this point in the history
  • Loading branch information
Yu-Core committed Apr 25, 2024
1 parent e42cc7d commit e64ef29
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 8 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: github pages

on:
workflow_dispatch:

env:
DOTNET_NOLOGO: true # Disable the .NET logo
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Disable the .NET first time experience
DOTNET_CLI_TELEMETRY_OPTOUT: true # Disable sending .NET CLI telemetry
DOTNET_VERSION: '8.0'
CSPROJ_FILE_PATH: 'YourWeather/YourWeather.WebAssembly/YourWeather.WebAssembly.csproj'

jobs:
deploy:
runs-on: ubuntu-latest
steps:
# Checkout the code
- uses: actions/checkout@v3
with:
fetch-depth: 0

# Install .NET SDK
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '${{ env.DOTNET_VERSION }}.x'

- name: Install .NET WebAssembly Tools
run: dotnet workload install wasm-tools

# Get the commit count and format the version
- name: Get commit count and format version
id: version
run: |
commit_count=$(git rev-list --count HEAD)
major=$((commit_count / 100))
minor=$((commit_count % 100 / 10))
patch=$((commit_count % 10))
formatted_version="$major.$minor.$patch"
echo "FORMATTED_VERSION=$formatted_version" >> $GITHUB_ENV
# Replace the version in the csproj file
- name: Update version in csproj
run: |
sed -i "s/<Version>.*<\/Version>/<Version>${{ env.FORMATTED_VERSION }}<\/Version>/" \
${{ env.CSPROJ_FILE_PATH }}
# Publish the site
- name: Publish
run: dotnet publish ${{ env.CSPROJ_FILE_PATH }} -c Release -o public -p GHPages=true

# Deploy the site
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: public/wwwroot
force_orphan: true
29 changes: 29 additions & 0 deletions .github/workflows/sync-gitee-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Sync Gitee Pages

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Sync to Gitee
uses: morbalint/git-mirror-action@master
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
with:
source_repo: "git@github.com:Yu-Core/YourWeather.git"
destination_repo: "git@gitee.com:Yu-core/YourWeather.git"
branches: "gh-pages"
force_push_branches: true

- name: Build Gitee Pages
uses: yanglbme/gitee-pages-action@master
with:
# 注意替换为你的 Gitee 用户名
gitee-username: Yu-core
# 注意在 Settings->Secrets 配置 GITEE_PASSWORD
gitee-password: ${{ secrets.GITEE_PASSWORD }}
# 注意替换为你的 Gitee 仓库
gitee-repo: Yu-core/YourWeather
branch: gh-pages
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">

<Identity Name="maui-package-name-placeholder" Publisher="CN=Yu-Core" Version="1.2.5.0" />
<Identity Name="maui-package-name-placeholder" Publisher="CN=Yu-Core" Version="1.4.4.0" />

<mp:PhoneIdentity PhoneProductId="0BB89DB7-95CB-4091-8716-782A7B583CC5" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

Expand Down
4 changes: 2 additions & 2 deletions YourWeather/YourWeather.Maui/YourWeather.Maui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<ApplicationId>com.yucore.yourweather</ApplicationId>
<ApplicationIdGuid>51BB1FB4-E5F4-4A9F-AD35-F805AC8F33E6</ApplicationIdGuid>
<!-- Versions -->
<ApplicationDisplayVersion>1.2.5</ApplicationDisplayVersion>
<ApplicationVersion>125</ApplicationVersion>
<ApplicationDisplayVersion>1.4.4</ApplicationDisplayVersion>
<ApplicationVersion>144</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">24.0</SupportedOSPlatformVersion>
Expand Down
2 changes: 1 addition & 1 deletion YourWeather/YourWeather.Photino/YourWeather.Photino.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>1.2.5</Version>
<Version>1.4.4</Version>
<ApplicationIcon>Resources/favicon.ico</ApplicationIcon>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion YourWeather/YourWeather.Server/YourWeather.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>1.2.5</Version>
<Version>1.4.4</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<Version>1.2.5</Version>
<Version>1.4.4</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
Expand Down
2 changes: 1 addition & 1 deletion YourWeather/YourWeather.Winform/YourWeather.Winform.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<ApplicationIcon>Resources\favicon.ico</ApplicationIcon>
<Version>1.2.5</Version>
<Version>1.4.4</Version>
<AssemblyName>你的天气</AssemblyName>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
Expand Down
2 changes: 1 addition & 1 deletion YourWeather/YourWeather.Wpf/YourWeather.Wpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<RootNamespace>YourWeather.Wpf</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<ApplicationIcon>Resources\favicon.ico</ApplicationIcon>
<Version>1.2.5</Version>
<Version>1.4.4</Version>
<AssemblyName>你的天气</AssemblyName>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
Expand Down

0 comments on commit e64ef29

Please sign in to comment.