ci: specify deploy branch #138
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: Release CI | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '[0-9]+.*' | |
workflow_dispatch: | |
jobs: | |
build-and-release: | |
permissions: | |
contents: write | |
runs-on: windows-2019 | |
env: | |
boost_version: 1.84.0 | |
BOOST_ROOT: ${{ github.workspace }}\deps\boost_1_84_0 | |
steps: | |
- name: Checkout last commit | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Configure build environment | |
shell: bash | |
run: | | |
cp env.vs2019.bat env.bat | |
# cache boost | |
- name: Cache Boost | |
id: cache-boost | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ env.BOOST_ROOT }} | |
key: ${{ runner.os }}-boost-${{ env.boost_version }} | |
# install boost if not cached | |
- name: Install Boost | |
if: steps.cache-boost.outputs.cache-hit != 'true' | |
shell: bash | |
run: | | |
./install_boost.bat | |
./build.bat boost arm64 | |
# add msbuild to PATH | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
# use upper stream released librime files if stable release | |
- name: Copy Rime files | |
run: | | |
.\github.install.bat | |
- name: Build data | |
run: | | |
.\build.bat data | |
- name: Build Weasel Release | |
id: build_weasel | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
RELEASE_BUILD: 1 | |
run: | | |
.\build.bat arm64 installer | |
- name: Build Weasel Nightly | |
id: build_weasel_nightly | |
if: github.ref == 'refs/heads/master' | |
run: | | |
.\build.bat arm64 installer | |
- name: Compress Debug Symbols | |
shell: pwsh | |
run: | | |
output\7z.exe a -t7z "./output/archives/debug_symbols.7z" "output/*.pdb" -r | |
- name: Extract changelog | |
shell: pwsh | |
run: | | |
.\extract_changelog.ps1 | |
if: startsWith(github.ref, 'refs/tags/') | |
# create nightly release | |
- name: Create Nightly release | |
if: ${{ github.repository == 'rime/weasel' && github.ref == 'refs/heads/master' }} | |
uses: 'marvinpinto/action-automatic-releases@latest' | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
automatic_release_tag: latest | |
prerelease: true | |
title: "Nightly Build" | |
files: | | |
./output/archives/weasel*.exe | |
./output/archives/debug_symbols.7z | |
# create stable release | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
./output/archives/weasel*.exe | |
./output/archives/debug_symbols.7z | |
body_path: ${{ github.workspace }}/RELEASE_CHANGELOG.md | |
- name: Generate testing/weasel/appcast.xml | |
run: | | |
.\build.bat appcast | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
path: testing\weasel\appcast.xml | |
update_appcast: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
needs: [build-and-release] | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: testing/weasel | |
merge-multiple: true | |
- run: ls -R testing/weasel | |
- name: Deploy appcast | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} | |
external_repository: rime/rime.github.io | |
publish_dir: ./testing/weasel/ | |
keep_files: true | |
publish_branch: master |