mirror of
https://github.com/trapd00r/LS_COLORS.git
synced 2024-12-22 05:42:12 +01:00
Add a release workflow to generate shell files
This commit is contained in:
parent
b2a4438a36
commit
79f4905651
3 changed files with 44 additions and 19 deletions
24
.github/workflows/build.yml
vendored
Normal file
24
.github/workflows/build.yml
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
name: 'Release'
|
||||
on:
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
release:
|
||||
if: github.event.pull_request.merged == true
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 'Check out Git repository'
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: 'Generate shell files'
|
||||
run: make generate
|
||||
|
||||
- name: 'Commit generated files'
|
||||
if: ${{ success() }}
|
||||
run: |
|
||||
git config user.name 'github-actions'
|
||||
git config user.email 'github-actions@github.com'
|
||||
git add lscolors.sh lscolors.csh
|
||||
git commit -m "Update shell files" || echo "No changes to commit"
|
||||
git push
|
20
Makefile
Normal file
20
Makefile
Normal file
|
@ -0,0 +1,20 @@
|
|||
FILE_NAME=lscolors
|
||||
export XDG_DATA_HOME ?= $${$$HOME/.local/share}
|
||||
|
||||
clean:
|
||||
@command rm ${FILE_NAME}.sh 2>/dev/null || true
|
||||
@command rm ${FILE_NAME}.csh 2>/dev/null || true
|
||||
|
||||
generate: clean
|
||||
@dircolors -b LS_COLORS > ${FILE_NAME}.sh
|
||||
@dircolors -b LS_COLORS > ${FILE_NAME}.csh
|
||||
|
||||
install: generate
|
||||
@command cp ${FILE_NAME}.sh ${FILE_NAME}.csh ${XDG_DATA_HOME}
|
||||
@echo "To enable the colors, add the following line to your shell's start-up script:"
|
||||
@echo ""
|
||||
@echo "For Bourne shell (e.g. ~/.bashrc or ~/.zshrc):"
|
||||
@echo " source ${XDG_DATA_HOME}/${FILE_NAME}.sh"
|
||||
@echo ""
|
||||
@echo "For C shell (e.g. ~/.cshrc):"
|
||||
@echo " source ${XDG_DATA_HOME}/${FILE_NAME}.csh"
|
19
install.sh
19
install.sh
|
@ -1,19 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
#
|
||||
|
||||
lscolors_data_dir="${XDG_DATA_HOME:-$HOME/.local/share}"
|
||||
|
||||
if dircolors -b LS_COLORS > lscolors.sh && dircolors -c LS_COLORS > lscolors.csh ; then
|
||||
if mv -t "$lscolors_data_dir" lscolors.sh lscolors.csh ; then
|
||||
cat <<EOF
|
||||
To enable the colors, add the following line to your shell's start-up script:
|
||||
|
||||
For Bourne shell (e.g. ~/.bashrc or ~/.zshrc):
|
||||
. "$lscolors_data_dir/lscolors.sh"
|
||||
|
||||
For C shell (e.g. ~/.cshrc):
|
||||
. "$lscolors_data_dir/lscolors.csh"
|
||||
|
||||
EOF
|
||||
fi
|
||||
fi
|
Loading…
Reference in a new issue