-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
95 additions
and
8 deletions.
There are no files selected for viewing
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
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 |
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
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 |
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
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
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
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
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
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
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