forked from felixonmars/fcitx5-pinyin-zhwiki
-
Notifications
You must be signed in to change notification settings - Fork 6
78 lines (71 loc) · 2.49 KB
/
build_dict.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Build dictionary
on:
push:
branches:
- pkg-moegirl
workflow_dispatch: {}
jobs:
build-and-publish:
if: "(contains(github.event_name, 'schedule') || !contains(github.event.commits[0].message, 'ci ckip'))"
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
persist-credentials: false
fetch-depth: "0"
path: "toolkit"
- name: Build dictionary
id: build-dictionary
run: |
DATE=$(date +%Y%m%d)
mkdir $GITHUB_WORKSPACE/artifacts
docker run -v $GITHUB_WORKSPACE/artifacts:/artifacts -v $GITHUB_WORKSPACE/toolkit:/toolkit archlinux:base-devel bash /toolkit/utils/build.sh "$DATE"
echo "DATE=$DATE" >> "$GITHUB_OUTPUT"
- name: Checkout profile
uses: actions/checkout@v4
with:
ref: pkg-moegirl
persist-credentials: false
fetch-depth: "0"
path: "profile"
- name: Update date
run: |
pushd profile
DATE="${{ steps.build-dictionary.outputs.DATE }}"
echo $DATE > LATEST
cat > recipe.yaml <<EOF
# encoding: utf-8
---
recipe:
Rx: moegirl-dict
description: >-
Install moegirl dict from fcitx5-pinyin-moegirl
download_files: >-
moegirl.dict.yaml::https://github.com/outloudvi/mw2fcitx/releases/download/$DATE/moegirl.dict.yaml
install_files: >-
moegirl.dict.yaml
EOF
git add ./LATEST
git add ./recipe.yaml
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git commit -m "chore: version $DATE"
popd
- name: Push the commit
uses: ad-m/github-push-action@master
with:
branch: pkg-moegirl
github_token: ${{ secrets.GITHUB_TOKEN }}
directory: profile
- name: Release
shell: bash
run: |
DATE="${{ steps.build-dictionary.outputs.DATE }}"
wget https://github.com/tcnksm/ghr/releases/download/v0.15.0/ghr_v0.15.0_linux_amd64.tar.gz -O ghr.tgz
tar xzf ghr.tgz
pushd profile
export COMMIT=$(git rev-parse HEAD)
popd
ghr_v0.15.0_linux_amd64/ghr -t ${{ secrets.GITHUB_TOKEN }} -u ${GITHUB_REPOSITORY/\/*/} -r ${GITHUB_REPOSITORY/*\//} -c "$COMMIT" -delete ${DATE} ./artifacts/