build Community Shaders and addons #14
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 Community Shaders and addons | |
on: | |
push: | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
env: | |
TRANSLATION_FILES: package/Interface/Translations/ | |
jobs: | |
translate: | |
name: translate plugin | |
runs-on: ubuntu-latest | |
env: | |
ISO: .github/workflows/iso.json | |
TRANSLATION_CACHE: locales/ | |
WHITELIST_FILES: CommunityShaders_english.txt | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: pull files from Lokalise | |
env: | |
LOKALISE_TOKEN: ${{ secrets.LOKALISE_API_TOKEN }} | |
PROJECT_ID: ${{ vars.PROJECT_ID }} | |
FILE_FORMAT: json | |
GITHUB_REF_NAME: ${{ github.ref_name }} | |
run: | | |
node .github/workflows/lokalise_download.mjs | |
- name: convert json to utf-16-le-bom txt | |
run: | | |
for file in $TRANSLATION_CACHE/*.json; do | |
if [[ -f "$file" ]]; then | |
iso_code=$(basename "$file" .json) | |
language=$(jq -r --arg iso "$iso_code" '.iso_lang[$iso]' $ISO) | |
if [[ -z "$language" || "$language" == "null" ]]; then | |
echo "Warning: ISO code '$iso_code' not found. Skipping $file." >&2 | |
continue | |
fi | |
output_file="$TRANSLATION_FILES/CommunityShaders_${language}.txt" | |
if [[ "$(basename "$output_file")" != "$WHITELIST_FILES" ]]; then | |
printf "\xFF\xFE" > "$output_file" | |
jq -r 'to_entries | .[] | "\(.key)\t\(.value)"' "$file" \ | |
| sed 's/$/\r/' | iconv -f UTF-8 -t UTF-16LE >> "$output_file" | |
fi | |
fi | |
done | |
- name: Upload translations | |
uses: actions/upload-artifact@v4 | |
with: | |
name: translations | |
path: ${{ env.TRANSLATION_FILES }} | |
compile: | |
name: build plugin and addons | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Download translations | |
uses: actions/download-artifact@v4 | |
with: | |
name: translations | |
path: ${{ env.TRANSLATION_FILES }} | |
- uses: ilammy/[email protected] | |
- uses: lukka/[email protected] | |
with: | |
vcpkgJsonGlob: vcpkg.json | |
- name: cmake configure | |
run: cmake -S . --preset=ALL --check-stamp-file "build\CMakeFiles\generate.stamp" | |
- name: cmake build | |
run: cmake --build build/ALL --config Release | |
- name: create a tagged release and upload the archive | |
uses: ncipollo/release-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: Community Shaders ${{ github.ref_name }} | |
draft: true | |
tag: ${{ github.ref_name }} | |
artifacts: "${{ github.workspace }}/dist/*.7z" |