-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (46 loc) · 1.48 KB
/
publish.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
name: publish dotfiles in the public repo 🚀
on:
push:
branches: [ master ]
jobs:
publish-dotfiles:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v3
with:
path: dotfiles-private
- name: Clone public repo and get its .git folder
run: |
git clone https://javfg:[email protected]/javfg/dotfiles dotfiles-copy
mkdir dotfiles
cp -r ./dotfiles-copy/.git ./dotfiles
- name: Copy new contents into public repo
run: |
rsync -a --exclude .git ./dotfiles-private/ ./dotfiles
- name: Fix gitignore
run: |
tail -n +2 ./dotfiles-private/.gitignore > ./dotfiles/.gitignore
sed -i -e 's/^[ \t]*# //g' ./dotfiles/.gitignore
- name: Configure GPG Key
run: |
echo -n "$GPG_SECRET_KEY" | base64 --decode | gpg --import
env:
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
- name: Configure git
run: |
cd ./dotfiles
git config user.name "Javier Ferrer"
git config user.email "[email protected]"
git config user.signingkey 39E146B959835FEB
- name: Commit if there are changes
run: |
cd ./dotfiles-private
export COMMIT_MSG=$(git --no-pager log --format=%B -n 1 HEAD)
cd ../dotfiles
git add -A
git commit -S -m "${COMMIT_MSG}" -m "Auto publish"
git push
continue-on-error: true
env:
DOTFILES_TOKEN: ${{ secrets.DOTFILES_TOKEN }}