Skip to content

Commit

Permalink
release: Set repository #1
Browse files Browse the repository at this point in the history
  • Loading branch information
orioncactus authored Aug 20, 2023
1 parent 0cce3f2 commit bad3b56
Show file tree
Hide file tree
Showing 32,505 changed files with 8,586,497 additions and 19 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.glyphs binary
*.otf binary
*.ttf binary
*.woff binary
*.woff2 binary
41 changes: 41 additions & 0 deletions .github/actions/auto-commit/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "Auto commit"
description: "Auto commit & push"

inputs:
file_pattern:
description: "Commit file pattern"
require: true
message:
description: "Commit message"
require: true
branch:
description: "Upload branch"
require: true

runs:
using: "composite"
steps:
- name: Commit Build File
shell: bash
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
LAST_COMMIT_NAME="$(git log -n 1 --pretty=format:%an)"
LAST_COMMIT_EMAIL="$(git log -n 1 --pretty=format:%ae)"
LAST_COMMIT_AUTHOR="Co-authored-by: ${LAST_COMMIT_NAME} <${LAST_COMMIT_EMAIL}>"
if [[ "$(git branch -r --contains ${{ inputs.branch }} 2>/dev/null)" ]]; then
git checkout ${{ inputs.branch }}
else
git checkout -b ${{ inputs.branch }}
fi
git add --ignore-removal ${{ inputs.file_pattern }}
if [[ "$(git diff --staged)" != "" ]]; then
git commit -m "${{ inputs.message }}" -m "${LAST_COMMIT_AUTHOR}"
if [[ "$(git branch -r --contains ${{ inputs.branch }} 2>/dev/null)" ]]; then
git push origin ${{ inputs.branch }}
else
git push -u origin ${{ inputs.branch }}
fi
fi
17 changes: 17 additions & 0 deletions .github/actions/setup-pip/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "setup pip"
description: "Setup pip cache & install"

runs:
using: "composite"
steps:
- name: pip cache
id: pip-cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
${{ runner.os }}-pip-
- run: pip3 install -r ./requirements.txt
shell: bash
19 changes: 19 additions & 0 deletions .github/actions/setup-yarn/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "setup yarn"
description: "Setup yarn cache & install"

runs:
using: "composite"
steps:
- name: node cache
id: node-cache
uses: actions/cache@v3
with:
path: |
.yarn/cache
**/tsconfig.tsbuildinfo
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-node-
- run: yarn install --immutable
shell: bash
32 changes: 32 additions & 0 deletions .github/actions/subset-push/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "subset and push"
description: "Subset workspace's font"

inputs:
workspace:
description: "Target workspace"
require: true
shard:
description: "Sharding definition like <index>/<total>"
require: true
branch:
description: "Upload branch"
require: true

runs:
using: "composite"
steps:
- name: Build Dependency
shell: bash
run: |
yarn workspace subset-utils run build
- name: Generate webfonts
shell: bash
run: |
yarn workspace ${{ inputs.workspace }} run subset
env:
SHARD: ${{ inputs.shard }}
- uses: ./.github/actions/auto-commit
with:
file_pattern: packages/*/dist/web/**
message: "fix: Auto-generate assets"
branch: ${{ inputs.branch }}
77 changes: 77 additions & 0 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Generate Assets

on:
push:
branches:
- main

jobs:
wemix-pretendard:
runs-on: ubuntu-latest
if: contains(github.event.head_commit.message, 'release:')
strategy:
matrix:
shard: ["1/6", "2/6", "3/6", "4/6", "5/6", "6/6"]
include:
- shard: "1/6"
branch: "ori-1"
- shard: "2/6"
branch: "ori-2"
- shard: "3/6"
branch: "ori-3"
- shard: "4/6"
branch: "ori-4"
- shard: "5/6"
branch: "ori-5"
- shard: "6/6"
branch: "ori-6"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: "0"
- uses: ./.github/actions/setup-pip
- uses: ./.github/actions/setup-yarn
- uses: ./.github/actions/subset-push
with:
workspace: wemix-pretendard
shard: ${{ matrix.shard }}
branch: ${{ matrix.branch }}

auto-update:
needs: [wemix-pretendard]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: "0"
- name: Commit Build File
shell: bash
run: |
# From ../actions/auto-commit
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
LAST_COMMIT_NAME="$(git log -n 1 --pretty=format:%an)"
LAST_COMMIT_EMAIL="$(git log -n 1 --pretty=format:%ae)"
LAST_COMMIT_AUTHOR="Co-authored-by: ${LAST_COMMIT_NAME} <${LAST_COMMIT_EMAIL}>"
BRANCHES=("ori-1" "ori-2" "ori-3" "ori-4" "ori-5" "ori-6")
for BRANCH in "${BRANCHES[@]}"; do
if [[ "$(git rev-parse --verify origin/${BRANCH} 2>/dev/null)" ]]; then
echo "${BRANCH}"
git rebase "origin/${BRANCH}"
git push origin --delete "${BRANCH}"
fi
done
LOG="fix: Auto-generate assets"
while [[ "$(git log -2 --pretty=%s | tail -1)" == "${LOG}" ]]; do
TWO_LOG="$(git log -2 --pretty=%s)"
if [[ "$(echo ${TWO_LOG} | head -1)" == "$(echo ${TWO_LOG} | tail -1)" ]]; then
git reset --soft "HEAD~1"
git commit --amend -m "${LOG}" -m "${LAST_COMMIT_AUTHOR}"
fi
done
if [[ "$(git log @{push}..)" != "" ]]; then
git push
fi
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release CI

on:
push:
tags: "v*" # push events to matching v*, i.e. v1.0, v20.15.10

jobs:
upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-yarn
- name: Set env
run: |
RELEASE_VERSION=${GITHUB_REF#refs/*/}
echo "RELEASE_NAME=${RELEASE_VERSION:1}" >> $GITHUB_ENV
- name: Zip
run: |
cd packages
# Remove Dynamic Subset Files
find -wholename "**/web/*/*dynamic-subset*" -delete
find -wholename "**/web/*/WEMIXPretendard*.css" -delete
# Zip
(cd wemix-pretendard/dist && zip -rv - .) > WEMIXPretendard-${{ env.RELEASE_NAME }}.zip
- uses: softprops/action-gh-release@v1 # actions/create-release, actions/upload-release-asset is deprecated
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
packages/WEMIXPretendard-${{ env.RELEASE_NAME }}.zip
Loading

0 comments on commit bad3b56

Please sign in to comment.