Skip to content

Commit

Permalink
Merge branch 'master' into hg24-awards
Browse files Browse the repository at this point in the history
  • Loading branch information
ustcljh authored Dec 30, 2024
2 parents 1595c01 + dd27abc commit 8145d12
Show file tree
Hide file tree
Showing 115 changed files with 1,788 additions and 1,093 deletions.
235 changes: 128 additions & 107 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,121 +2,142 @@ name: build

on:
push:
branches: ['*']
branches: ["*"]
pull_request:
branches: ['*']
branches: ["*"]
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
build:
runs-on: ubuntu-latest
env:
LSI: 'true'
LSI: "true"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
- uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache Ruby gems
uses: actions/cache@v4
env:
CACHE_ID: 1
with:
path: |
Gemfile.lock
vendor/bundle
key: ${{ runner.os }}-bundler-${{ env.CACHE_ID }}-${{ hashFiles('Gemfile') }}
restore-keys: |
${{ runner.os }}-bundler-${{ env.CACHE_ID }}-
- name: Cache Node modules
uses: actions/cache@v4
env:
CACHE_ID: 1
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ env.CACHE_ID }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-${{ env.CACHE_ID }}-
- name: Install dependencies
run: |
bundle config set --local path vendor/bundle
bundle install --jobs=4 --retry=3
bundle clean
npm install --include=dev
- name: Prettier check
id: prettier
run: npm run check
- name: Prettier fix
if: "failure() && steps.prettier.outcome == 'failure'"
run: npm run fix
- name: Submit PR for prettier fix
if: "failure() && steps.prettier.outcome == 'failure' && github.ref == 'refs/heads/master'"
uses: peter-evans/create-pull-request@v6
with:
commit-message: 'Prettier auto fix from GitHub Actions run ${{ github.run_number }}'
assignees: '${{ github.actor }}'
branch: prettier-auto-fix
delete-branch: true
title: 'Fix Prettier formatting from GitHub Actions run ${{ github.run_number }}'
body: |
Attempt to automatically fix Prettier formatting issues in ${{ github.sha }}.
This PR is generated by GitHub Actions [run ${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}). Please choose **Squash and Merge** for this PR.
- name: Prepare build
if: github.ref == 'refs/heads/master'
run: |
git clone --depth=1 --branch=gh-pages --single-branch --no-checkout \
"https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" \
_site
- name: Run Jekyll Doctor
run: |
bundle exec jekyll doctor --trace --profile
env:
JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build site
run: |
bundle exec jekyll build --trace --profile
: > _site/.nojekyll
env:
JEKYLL_ENV: production
JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/master'
run: |
CINFO="$(git log -1 --pretty="%an: [%h] %s")"
pushd _site/ &>/dev/null
echo -n lug.ustc.edu.cn > CNAME
git add -A
git -c user.name=GitHub -c [email protected] commit \
-m "Auto deploy from GitHub Actions build ${GITHUB_RUN_NUMBER}" \
-m "$CINFO"
git push
popd &>/dev/null
- name: Update Algolia index
if: github.ref == 'refs/heads/master'
run: bundle exec jekyll algolia push
env:
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true

- name: Call webhook
if: "github.repository == 'ustclug/website' && github.ref == 'refs/heads/master'"
env:
WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }}
run: ruby _scripts/webhook.rb
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0"
- uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache Ruby gems
uses: actions/cache@v4
env:
CACHE_ID: 1
with:
path: |
Gemfile.lock
vendor/bundle
key: ${{ runner.os }}-bundler-${{ env.CACHE_ID }}-${{ hashFiles('Gemfile') }}
restore-keys: |
${{ runner.os }}-bundler-${{ env.CACHE_ID }}-
- name: Cache Node modules
uses: actions/cache@v4
env:
CACHE_ID: 1
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ env.CACHE_ID }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-${{ env.CACHE_ID }}-
- name: Install dependencies
run: |
bundle config set --local path vendor/bundle
bundle config set without 'development'
bundle install --jobs=4 --retry=3
bundle clean
npm install --include=dev
# debugging algolia slow bug
sed -i '/status = get_task_status(index_name, taskID, request_options)/a\ puts status' vendor/bundle/ruby/*/gems/algoliasearch-*/lib/algolia/client.rb
- name: "Linting: autocorrect"
continue-on-error: true
run: |
curl -fsSL https://raw.githubusercontent.com/huacnlee/autocorrect/main/install | sh
autocorrect --fix ./*
- name: Prettier fix
continue-on-error: true
run: npm run fix

- name: Determine if a PR should be submitted
if: github.ref == 'refs/heads/master'
id: file_changes
run: |
git add -A
if git diff-index --quiet --cached HEAD --; then
echo "should_submit=false" >> "$GITHUB_OUTPUT"
else
echo "should_submit=true" >> "$GITHUB_OUTPUT"
fi
- name: Submit PR from linting
if: steps.file_changes.outputs.should_submit == 'true' && github.ref == 'refs/heads/master'
uses: peter-evans/create-pull-request@v6
with:
commit-message: "Auto fix formatting from GitHub Actions run ${{ github.run_number }}"
assignees: "${{ github.actor }}"
branch: auto-fix-actions-${{ github.run_number }}
delete-branch: true
title: "Fix formatting from GitHub Actions run ${{ github.run_number }}"
body: |
Attempt to automatically fix formatting issues in ${{ github.sha }}.
This PR is generated by GitHub Actions [run ${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}). Please choose **Squash and Merge** for this PR.
- name: Prepare build
if: github.ref == 'refs/heads/master'
run: |
git clone --depth=1 --branch=gh-pages --single-branch --no-checkout \
"https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" \
_site
- name: Run Jekyll Doctor
run: |
bundle exec jekyll doctor --trace --profile
env:
JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build site
run: |
bundle exec jekyll build --trace --profile
: > _site/.nojekyll
env:
JEKYLL_ENV: production
JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/master'
run: |
CINFO="$(git log -1 --pretty="%an: [%h] %s")"
pushd _site/ &>/dev/null
echo -n lug.ustc.edu.cn > CNAME
git add -A
git -c user.name=GitHub -c [email protected] commit \
-m "Auto deploy from GitHub Actions build ${GITHUB_RUN_NUMBER}" \
-m "$CINFO"
git push
popd &>/dev/null
- name: Update Algolia index
if: github.ref == 'refs/heads/master'
run: bundle exec jekyll algolia push
env:
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true

- name: Call webhook
if: "github.repository == 'ustclug/website' && github.ref == 'refs/heads/master'"
continue-on-error: true
env:
WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }}
run: ruby _scripts/webhook.rb
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ group :jekyll_plugins do
gem 'jekyll-paginate-v2', '>= 3.0.0'
gem 'jekyll-algolia'
end

group :development do
gem 'html-proofer'
end
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@

1. 安装 Node.js 开发环境(略)
2. 运行 `npm install` 以安装 prettier
3. 使用 `npm run fix` 自动格式化。可以将不希望 prettier 处理的文件加入 `.prettierignore`,未来可能会加上 YAML 和 SCSS 格式文件的处理
4. 使用 `npm run check` 验证格式无问题
3. 使用 `npm run check` 验证格式无问题
4. 使用 `npm run fix` 自动格式化

可以将不希望 prettier 处理的文件加入 `.prettierignore`,未来可能会加上 YAML 和 SCSS 格式文件的处理

## 许可

Expand Down
6 changes: 6 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,12 @@ jekyll-archives:
tag: /tags/:name/


# jekyll-relative-links
relative_links:
enabled: true
collections: true


# Defaults
defaults:
# _posts
Expand Down
11 changes: 11 additions & 0 deletions _data/authors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,14 @@ tiankaima:
- label: GitHub
icon: fab fa-fw fa-github
url: https://github.com/tiankaima

ibug:
name: iBug
avatar: "https://avatars.githubusercontent.com/u/7273074?v=4"
links:
- label: GitHub
icon: fab fa-fw fa-github
url: https://github.com/iBug
- label: Stack Overflow
icon: fab fa-fw fa-stack-overflow
url: https://stackoverflow.com/users/5958455/ibug
66 changes: 40 additions & 26 deletions _data/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,65 @@ main:
url: "https://mirrors.ustc.edu.cn/"

wiki:
- title: LUG @ USTC
- title: 关于
children:
- title: '<i class="fad fa-lg fa-fw fa-home"></i> LUG @ USTC'
url: /wiki/
- title: '<i class="fad fa-lg fa-address-card"></i> 关于我们'
url: /wiki/intro/
- title: 服务
children:
- title: '<i class="fad fa-lg fa-fw fa-home"></i> LUG 首页'
url: /
- title: '<i class="fad fa-lg fa-fw fa-newspaper"></i> LUG 新闻'
url: /news/
- title: '<i class="fad fa-lg fa-fw fa-certificate"></i> LUG 服务'
url: /wiki/lug/services/
- title: '<i class="fad fa-lg fa-fw fa-link"></i> 友情链接'
url: /wiki/lug/links/
- title: '<i class="fad fa-lg fa-fw fa-database"></i> 开源软件镜像'
- title: '<i class="fad fa-lg fa-fw fa-database"></i> 开源镜像站'
url: /wiki/lug/services/mirrors/
- title: '<i class="fad fa-lg fa-fw fa-network-wired"></i> 网络启动平台'
url: /wiki/lug/services/pxe/
- title: '<i class="fad fa-lg fa-fw fa-code"></i> 代码托管平台'
url: /wiki/lug/services/gitlab/
- title: '<i class="fad fa-lg fa-fw fa-folder"></i> 文件存档'
url: /wiki/lug/services/ftp/
- title: 活动
children:
- title: '<i class="fad fa-lg fa-fw fa-sparkles"></i> LUG 活动'
url: /wiki/lug/events/
- title: '<i class="fad fa-lg fa-fw fa-users-class"></i> 每周小聚'
url: /wiki/lug/events/weeklyparty/
- title: '<i class="fad fa-lg fa-fw fa-graduation-cap"></i> Linux 101'
url: https://101.lug.ustc.edu.cn/
- title: '<i class="fad fa-lg fa-fw fa-envelope-open-text"></i> 邮件列表'
url: /wiki/lug/mailinglist/
- title: '<i class="fad fa-lg fa-fw fa-books"></i> LUG 书库'
url: /wiki/lug/book/
- title: '<i class="fad fa-lg fa-fw fa-piggy-bank"></i> LUG 财务'
url: /wiki/lug/finance/
url: /wiki/lug/events/101/
- title: '<i class="fad fa-lg fa-fw fa-flag"></i> 信息安全大赛'
url: /wiki/lug/events/hackergame/
- title: '<i class="fad fa-lg fa-fw fa-comment"></i> 软件自由日'
url: /wiki/lug/events/sfd/
- title: 联系
children:
- title: '<i class="fad fa-lg fa-fw fa-user-tie"></i> LUG 负责人'
url: /wiki/lug/person-in-charge/
- title: '<i class="fas fa-lg fa-fw fa-phone-alt"></i> 联系我们'
url: /wiki/lug/contact/
- title: '<i class="fad fa-lg fa-fw fa-users-medical"></i> 加入我们'
url: /wiki/lug/contribute/
- title: '<i class="fad fa-lg fa-fw fa-donate"></i> 捐赠我们'
url: /wiki/lug/finance/donate/
- title: 资源
- title: '<i class="fad fa-lg fa-fw fa-user-tie"></i> LUG 负责人'
url: /wiki/lug/person-in-charge/
- title: 文档
children:
- title: '<i class="fad fa-lg fa-fw fa-book"></i> Linux 文摘'
url: /wiki/linux_digest/
- title: '<i class="fad fa-lg fa-fw fa-bookmark"></i> 资源导航'
url: /wiki/lug/resources/
- title: '<i class="fad fa-lg fa-fw fa-server"></i> 服务器新闻'
url: 'https://servers.ustclug.org/'
- title: '<i class="fas fa-lg fa-fw fa-question-square"></i> 校园网常见问题'
url: /wiki/doc/ustcnet-faq/
- title: '<i class="fas fa-lg fa-fw fa-universal-access"></i> 提问指南'
url: /wiki/doc/howtoask/
- title: '<i class="fas fa-lg fa-fw fa-pen"></i> 修订指南'
url: /wiki/doc/editing/

# # I'm thinking about deleting all the following items
# - title: 其他
# children:
# - title: '<i class="fad fa-lg fa-fw fa-bookmark"></i> 资源导航'
# url: /wiki/lug/resources/
# - title: '<i class="fad fa-lg fa-fw fa-books"></i> LUG 书库'
# url: /wiki/lug/book/
# - title: '<i class="fad fa-lg fa-fw fa-piggy-bank"></i> LUG 财务'
# url: /wiki/lug/finance/
# - title: '<i class="fad fa-lg fa-fw fa-server"></i> 服务器新闻'
# url: 'https://servers.ustclug.org/'
# - title: '<i class="fad fa-lg fa-fw fa-link"></i> 友情链接'
# url: /wiki/lug/links/
# - title: '<i class="fad fa-lg fa-fw fa-book"></i> Linux 文摘'
# url: /wiki/linux_digest/
Loading

0 comments on commit 8145d12

Please sign in to comment.