Fix Workflow #10
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: Build packages | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
mac_linux: | |
runs-on: ubuntu-latest | |
if: ${{ github.ref || github.ref == 'refs/heads/main' }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3.5.0 | |
- run: mkdir output | |
- run: chmod u+x .ci/* | |
- run: mkdir -p build/mac | |
- name: build | |
run: | | |
export SQUIRREL_VERSION=$( git ls-remote --tags --refs --sort="v:refname" https://github.com/rime/squirrel.git | tail -n1 | sed 's/.*\///' ) | |
export SQUIRREL_LINK=https://github.com/rime/squirrel/releases/download/${SQUIRREL_VERSION}/Squirrel-${SQUIRREL_VERSION}.zip | |
export SQUIRREL_PACKAGES="cantonese emoji CanCLID/rime-loengfan custom:set:config=default,key=installed_from,value=rime-cantonese custom:clear_schema_list custom:add:schema=jyut6ping3 custom:add:schema=cangjie5 custom:add:schema=stroke custom:add:schema=luna_pinyin lotem/rime-octagram-data lotem/rime-octagram-data@hant lotem/rime-octagram-data:customize:schema=jyut6ping3,model=hant" | |
export IBUS_PACKAGES=${SQUIRREL_PACKAGES} | |
# Download Mac installation script, Mac package and unzip | |
wget ${SQUIRREL_LINK} | |
7z e Squirrel*.zip -obuild/mac/ | |
cat .ci/mac-install-template.sh | envsubst '${SQUIRREL_PACKAGES}' > ./build/mac/mac-install.sh | |
# Build archives | |
7z a output/mac-${GITHUB_REF_NAME}-installer.zip ./build/mac/* | |
# Copy default.custom.yaml and ibus-install.sh into output queue | |
cat .ci/ibus-install-template.sh | envsubst '${IBUS_PACKAGES}' > ./output/ibus-install.sh | |
cp .ci/default.custom.yaml output/ | |
- uses: softprops/action-gh-release@v0.1.15 | |
with: | |
files: output/* | |
if: startsWith(github.ref, 'refs/tags/') | |
- run: ls output | |
windows: | |
runs-on: ubuntu-latest | |
if: ${{ github.ref || github.ref == 'refs/heads/main' }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3.5.0 | |
- run: sudo apt-get install p7zip-full | |
- run: mkdir output | |
- run: chmod u+x .ci/* | |
- run: mkdir -p build/windows/data | |
- run: | | |
export WEASEL_VERSION=$( git ls-remote --tags --refs --sort="v:refname" https://github.com/rime/weasel.git | tail -n1 | sed 's/.*\///' ) | |
export WEASEL_LINK=https://github.com/rime/weasel/releases/download/${WEASEL_VERSION}/weasel-${WEASEL_VERSION}.0-installer.exe | |
export WEASEL_PACKAGES="cantonese emoji CanCLID/rime-loengfan custom:set:config=default,key=installed_from,value=rime-cantonese custom:clear_schema_list custom:add:schema=jyut6ping3 custom:add:schema=cangjie5 custom:add:schema=stroke custom:add:schema=luna_pinyin lotem/rime-octagram-data lotem/rime-octagram-data@hant lotem/rime-octagram-data:customize:schema=jyut6ping3,model=hant" | |
export SFXHEADER=7zSD.sfx | |
# Prepare update installation script template version number | |
cat .ci/windows-install-template.bat | envsubst > ./build/windows/windows-install.bat | |
# Download IME files (and 32-bit OpenCC) | |
export rime_dir=build/windows/data | |
curl -fsSL https://git.io/rime-install | bash -s -- ${WEASEL_PACKAGES} | |
# Prepare installer exe | |
wget -P ./build/windows ${WEASEL_LINK} --no-check-certificate | |
# Packing sfx installer... | |
wget https://github.com/tanxpyox/7z.sfx-backup/raw/master/${SFXHEADER} | |
7z a windows-installer.7z ./build/windows/* | |
cat ${SFXHEADER} .ci/config.txt windows-installer.7z > output/windows-sfx-${GITHUB_REF_NAME}-installer.exe | |
# Packing installer files into a separate zip | |
7z a output/windows-${GITHUB_REF_NAME}-installer.zip ./build/windows/* | |
- uses: softprops/action-gh-release@v0.1.15 | |
with: | |
files: output/* | |
if: startsWith(github.ref, 'refs/tags/') | |
- run: ls output |