Skip to content

Update workflow

Update workflow #28

Workflow file for this run

name: Upload zip
on: [push, workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Make release zip
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
run: |
FONT_VERSION=$(cat version.json | jq -r '.version')
FONT_P1_URL="https://github.com/Fitzgerald-Porthmouth-Koenigsegg/Plangothic-Project/releases/download/${FONT_VERSION}/PlangothicP1-Regular.allideo.ttf"
FONT_P2_URL="https://github.com/Fitzgerald-Porthmouth-Koenigsegg/Plangothic-Project/releases/download/${FONT_VERSION}/PlangothicP2-Regular.ttf"
NOTOCJK_VERSION=$(curl -s https://api.github.com/repos/simonsmh/notocjk/releases/latest | jq -r '.tag_name')
NOTOCJK_URL="https://github.com/simonsmh/notocjk/releases/download/${NOTOCJK_VERSION}/notocjk.zip"
wget "$NOTOCJK_URL" -O ../notocjk.zip
mkdir -p ../notocjk
unzip ../notocjk.zip -d ../notocjk/
cp -rf ../notocjk/system .
cp ../notocjk/customize.sh .
TARGET_COMMAND="sed -i 's/<\\\\/familyset>/<family>\\\\n<font weight=\"400\" style=\"normal\">DroidSansFallbackFull.ttf<\\\\/font>\\\\n<\\\\/family>\\\\n<\\\\/familyset>/g' \$MODPATH\$SYSTEMFILEPATH\$FILE"
NEW_COMMAND="sed -i 's/<\\\\/familyset>/<family>\\\\n<font weight=\"400\" style=\"normal\">PlangothicP1-Regular.allideo.ttf<\\\\/font>\\\\n<\\\\/family>\\\\n<family>\\\\n<font weight=\"400\" style=\"normal\">PlangothicP2-Regular.ttf<\\\\/font>\\\\n<\\\\/family>\\\\n<\\\\/familyset>/g' \$MODPATH\$SYSTEMFILEPATH\$FILE"
LINE_NUMBER=$(grep -n "$TARGET_COMMAND" customize.sh | cut -d ":" -f 1)
if [ -n "$LINE_NUMBER" ]; then
sed -i "$LINE_NUMBER a $NEW_COMMAND" customize.sh
else
echo "Target command not found in the file. Contact repo owner to update their code."
fi
wget "$FONT_P1_URL" -O system/fonts/PlangothicP1-Regular.allideo.ttf
wget "$FONT_P2_URL" -O system/fonts/PlangothicP2-Regular.ttf
wget https://github.com/topjohnwu/Magisk/raw/master/scripts/module_installer.sh -O META-INF/com/google/android/update-binary
zip -9 -x "*.git*" -x "extra/*" -x "extra" -r ../Plangothic-magisk-module.zip ./
sha256sum ../Plangothic-magisk-module.zip > ../Plangothic-magisk-module.zip.sha256sum
mkdir -p build
cp ../Plangothic-magisk-module.zip build/
cp ../Plangothic-magisk-module.zip.sha256sum build/
- uses: actions/upload-artifact@v4
with:
name: Plangothic-magisk-module
path: |
build/Plangothic-magisk-module.zip
build/Plangothic-magisk-module.zip.sha256sum
nightly-release:
permissions: write-all
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') != true
steps:
- uses: actions/download-artifact@v4
with:
name: Plangothic-magisk-module
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.PAT }}"
automatic_release_tag: "nightly-release"
prerelease: true
title: "Test build"
files: |
Plangothic-magisk-module.zip
Plangothic-magisk-module.zip.sha256sum
release:
permissions: write-all
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: Plangothic-magisk-module
- name: Release Action
uses: softprops/action-gh-release@v2
with:
files: |
Plangothic-magisk-module.zip
Plangothic-magisk-module.zip.sha256sum
body_path: extra/changelog_latest.md