summaryrefslogtreecommitdiff
path: root/blog
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2021-08-15 13:34:35 +0300
committereug-vs <eugene@eug-vs.xyz>2021-08-15 13:40:00 +0300
commit0ab4193d1509dd0fcc75932a03870f6a03e6acca (patch)
tree8f4911c1b78f5ce57638ebcb287757759ce12284 /blog
parent84dfc818bb613752f17b11e17fd4e19c9dffe65b (diff)
downloadeug-vs-xyz-0ab4193d1509dd0fcc75932a03870f6a03e6acca.tar.gz
style: fix indentations and image sizes
Diffstat (limited to 'blog')
-rw-r--r--blog/2021-07-15.md60
1 files changed, 30 insertions, 30 deletions
diff --git a/blog/2021-07-15.md b/blog/2021-07-15.md
index f53009e..45f9f37 100644
--- a/blog/2021-07-15.md
+++ b/blog/2021-07-15.md
@@ -63,11 +63,11 @@ jobs:
The `defaults` part might look scary, but you could just move everything from defaults directly under `upload_stickers` job.
Defaults are useful when you have multiple jobs, and I planned to have 2 initially. Let's now move to the `steps`:
```YAML
- - checkout
+- checkout
- - run:
- name: Install python dependencies
- command: pip3 install .
+- run:
+ name: Install python dependencies
+ command: pip3 install .
```
Obviously we checkout our code first, and then install all the dependencies for our `Python` script.
@@ -87,11 +87,11 @@ orbs:
Now back to the steps. Let's install the tool and use it to generate our `config.json`:
```YAML
- - envsubst/install
+- envsubst/install
- - run:
- name: Create config.json from template
- command: envsubst < config.template.json > config.json
+- run:
+ name: Create config.json from template
+ command: envsubst < config.template.json > config.json
```
Ok so we can now login into `Matrix`, but what about `Telegram`? The script uses `Telethon` package under the hood which works with a `sticker-import.session` file. This is basically an `SQL` database, and I don't really
@@ -100,33 +100,33 @@ Of course, someone could try to decrypt my `Telethon` session since it's now pub
Our next steps in config will be to decrypt the session and finally pipe our `telegram-packs.txt` to the script using `xargs`:
```YAML
- - run:
- name: Decrypt telethon session
- command: gpg --batch --passphrase $PASSPHRASE --decrypt sticker-import.session.gpg > sticker-import.session
+- run:
+ name: Decrypt telethon session
+ command: gpg --batch --passphrase $PASSPHRASE --decrypt sticker-import.session.gpg > sticker-import.session
- - run:
- name: Reupload and install stickers
- command: cat telegram-packs.txt | xargs sticker-import
+- run:
+ name: Reupload and install stickers
+ command: cat telegram-packs.txt | xargs sticker-import
```
At this point, the stickers are uploaded to the server, but the UI is updated via it's own `.json` file which contains information about uploaded stickers. It's already updated by the script, we just have to push it to our repo.
For that I've created a new SSH key and added it to `CircleCI` secrets so that it can push commits to my repository. So the final steps would be:
```YAML
- - add_ssh_keys
-
- - run:
- name: Add github to known_hosts
- command: |
- mkdir -p ~/.ssh
- ssh-keyscan github.com >> ~/.ssh/known_hosts
- - run:
- name: Commit stickerpack JSON's
- command: |
- git config --global user.email "eug-vs@keemail.me"
- git config --global user.name "eug-vs"
- git add .
- git commit -m "feat: add stickerpacks with CircleCI [ci skip]"
- git push -u
+- add_ssh_keys
+
+- run:
+ name: Add github to known_hosts
+ command: |
+ mkdir -p ~/.ssh
+ ssh-keyscan github.com >> ~/.ssh/known_hosts
+- run:
+ name: Commit stickerpack JSON's
+ command: |
+ git config --global user.email "eug-vs@keemail.me"
+ git config --global user.name "eug-vs"
+ git add .
+ git commit -m "feat: add stickerpacks with CircleCI [ci [skip](skip.md)]"
+ git push -u
```
The `[ci skip]` flag tells Circle to avoid running on this commit, otherwise it would have to run once again since we pushed a new commit with it.
@@ -136,6 +136,6 @@ need to check the **new** packs in the `telegram-packs.txt` - the script is actu
And that's it! Now every time I add new URLs to the `telegram-packs.txt`, they will automatically appear in my widget within a minute or so. Enjoy your stickers!
-![wojak-brain-chair](/public/wojak-brainchair.jpg)
+![wojak-brain-chair](/public/wojak-brainchair.png)
You can find full version of the config here: https://github.com/eug-vs/stickerpicker/blob/master/.circleci/config.yml