-
Notifications
You must be signed in to change notification settings - Fork 16
59 lines (57 loc) · 2.01 KB
/
encrypt_with_assets.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
name: Encrypt Page with Assets
on:
push:
branches: [main]
jobs:
encrypt:
runs-on: ubuntu-latest
container:
image: nikolaik/python-nodejs:python3.11-nodejs20-slim
permissions: # See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idpermissions
contents: write
pages: write
steps:
- name: Install Git
run: |
apt-get clean && apt-get update -y
apt-get install -y git
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/checkout@v3
- name: Install staticrypt
run: npm install -g staticrypt@3.*
- name: Remove template salt (if necessary)
run: |
current_salt="$(grep -oP '(?<="salt": ")[^"]*' .staticrypt.json)"
if [ "${{ github.repository }}" != "a-nau/password-protected-website-template" ] && [ "$current_salt" == "9fdd6a30e734b0ce7de31a0a221786bf" ];
then
rm .staticrypt.json
fi
- name: Embed assets
run: |
pip install beautifulsoup4
python embed.py
- name: Encrypt index
run: >
staticrypt index.html -p ${{ secrets.DECRYPTION_PASSPHRASE }} --short
--template "password_template.html"
--template-title "Login"
--template-instructions "This is a test website, use the password 'test' to enter."
--template-button "Open Page"
--template-color-primary "#113e9f"
--template-color-secondary "#e4e4e4"
- name: Clean up
run: |
mv encrypted/index.html index.html
rm -r encrypted
- name: Commit files
run: |
git config user.name github-actions
git config user.email [email protected]
git add .
git commit -m "encrypted files"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
force: true