Create workflow to build CSS releases
This commit is contained in:
parent
9aae26745d
commit
3a1f4f204a
44
.forgejo/workflows/build-and-release.yaml
Normal file
44
.forgejo/workflows/build-and-release.yaml
Normal file
|
@ -0,0 +1,44 @@
|
|||
name: Build and release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install lessc
|
||||
run: npm install -g less
|
||||
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Parse commit hash
|
||||
run: echo "RELEASE_TAG=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV
|
||||
|
||||
- name: Build CSS
|
||||
run: |
|
||||
mkdir dist
|
||||
./build.sh
|
||||
tar -C dist -cvf themes.tar .
|
||||
mv themes.tar dist
|
||||
id: build
|
||||
|
||||
- name: Publish release
|
||||
uses: actions/forgejo-release@v1
|
||||
with:
|
||||
direction: upload
|
||||
release-dir: dist
|
||||
token: ${{ github.token }}
|
||||
tag: $RELEASE_TAG
|
||||
release-notes: |
|
||||
Automatic release triggered by commit ${{ github.sha }}
|
||||
|
||||
Add the following to \`app.ini\`:
|
||||
\`\`\`ini
|
||||
[ui]
|
||||
THEMES = ${{ steps.build.outputs.themes }}
|
||||
\`\`\`
|
||||
|
||||
And download the CSS files from this release to \`\$GITEA_DATA_DIR/gitea/public/css\`. [\`themes.tar\`](/Lea/gitea-themes/releases/download/$RELEASE_TAG/themes.tar) contains all CSS files for convenience.
|
7
build.sh
7
build.sh
|
@ -3,12 +3,19 @@
|
|||
BASEDIR="$( cd "$( dirname "$0" )" && pwd )"
|
||||
cd "${BASEDIR}"
|
||||
|
||||
theme_list=""
|
||||
|
||||
for theme in edge gruvbox gruvbox-material everforest; do
|
||||
for variant in dark light auto; do
|
||||
theme_list="$theme_list,$theme-$variant"
|
||||
lessc -x "src/${theme}-${variant}.less" > "dist/theme-${theme}-${variant}.css"
|
||||
done
|
||||
done
|
||||
|
||||
for theme in nord palenight soft-era sonokai sonokai-andromeda sonokai-atlantis sonokai-espresso sonokai-maia sonokai-shusia; do
|
||||
theme_list="$theme_list,$theme"
|
||||
lessc -x "src/${theme}.less" > "dist/theme-${theme}.css"
|
||||
done
|
||||
|
||||
# First character in theme_list will be a comma, let's remove that
|
||||
echo "themes=${theme_list:1}" >> $GITHUB_OUTPUT
|
||||
|
|
Loading…
Reference in a new issue