Skip to content

fix: ashveil teammate setting (#1572) #406

fix: ashveil teammate setting (#1572)

fix: ashveil teammate setting (#1572) #406

name: starrailoptimizer
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Find and Replace homepage
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "\"homepage\": \"https://fribbels.github.io/hsr-optimizer\""
replace: "\"homepage\": \"https://starrailoptimizer.github.io\""
include: 'package.json'
- name: Find and Replace vite page
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "base: '/hsr-optimizer'"
replace: "base: ''"
include: 'vite.config.ts'
- name: Find and Replace router path
uses: jacobtomlinson/gha-find-replace@v3
with:
find: 'const BASE_PATH: BasePath = BasePath.MAIN'
replace: "const BASE_PATH = ''"
include: 'src/lib/state/db.ts'
- name: Find and Replace Beta header
uses: jacobtomlinson/gha-find-replace@v3
with:
find: 'Fribbels Honkai Star Rail Optimizer'
replace: 'Fribbels Honkai Star Rail Optimizer (No leaks)'
include: 'src/lib/layout/LayoutHeader.tsx'
- name: Find and Replace officialOnly
uses: jacobtomlinson/gha-find-replace@v3
with:
find: 'export const officialOnly = false'
replace: 'export const officialOnly = true'
include: 'src/lib/constants/constants.ts'
- run: rm -rf .github/workflows
- run: mv .github/starrailoptimizer .github/workflows
- name: Push to target repository
run: |
# Setup SSH key
mkdir -p ~/.ssh
echo "${{ secrets.STAR_RAIL_OPTIMIZER_SSH_DEPLOY_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
# Configure git
git config --global user.name "fribbels"
git config --global user.email "fribbelsgithub@gmail.com"
# Clone target repository
git clone git@github.com:starrailoptimizer/starrailoptimizer.github.io.git target-repo
# Remove all files except .git directory
find target-repo -mindepth 1 -not -path 'target-repo/.git*' -delete
# Copy all files from current directory except .git and target-repo
rsync -av --exclude='.git' --exclude='target-repo' ./ target-repo/
# Commit and push changes
cd target-repo
git add .
if git commit -m "Update from ${{ github.repository }}@${{ github.sha }}"; then
git push origin main
else
echo "No changes to commit"
fi