Skip to content

Commit

Permalink
feat: workflow to publish articles to Dev.to
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerlepine committed Apr 3, 2024
1 parent 845d704 commit f9bc459
Show file tree
Hide file tree
Showing 19 changed files with 214 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/calibreapp-image-optimizer.yml
@@ -1,4 +1,4 @@
name: Compress Images
name: "[Cleanup] Compress Images"
on:
pull_request:
# Run Image Actions when JPG, JPEG, PNG or WebP files are added or changed.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/github-pages-deploy.yml
@@ -1,4 +1,4 @@
name: GitHub Pages Deploy
name: "[Deploy] GitHub Pages"

on:
workflow_dispatch:
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/post-to-dev-to.yml
@@ -0,0 +1,31 @@
name: "[Publish] Dev.to Article"
# uses: https://github.com/sinedied/publish-devto

on:
workflow_dispatch:
inputs:
folder:
description: 'Article folder name: blog/<THIS_FOLDER_NAME>/index.devto'
required: true
type: string

jobs:
post-to-dev-to:
name: Post to Dev.to
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Publish articles on dev.to
# uses: sinedied/publish-devto@v2
uses: spencerlepine/publish-devto@v1.0.0
with:
# Your dev.to personal API key to publish and update articles.
# See https://docs.dev.to/api/#section/Authentication/api_key
devto_key: ${{ secrets.DEVTO_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
# (Optional) The files to publish. Default is "posts/**/*.md"
# files: 'blog/**/*.md'
files: "blog/${{ inputs.folder }}/index.devto"
# (Optional) The git branch to use. Default is 'main'.
branch: main
conventional_commits: false
17 changes: 11 additions & 6 deletions .github/workflows/post-to-medium.yml
@@ -1,17 +1,22 @@
name: Medium Article Publish
name: "[Publish] Medium Article"
# uses: https://github.com/philips-software/post-to-medium-action

on:
workflow_dispatch:
inputs:
file:
description: 'Path to file: blog/title/index.md'
folder:
description: 'Article folder name: blog/<THIS_FOLDER_NAME>/index.medium'
required: true
type: string
title:
description: 'Article Title'
required: true
type: string
tags:
description: 'List of tags (eg. "tag1,tag2")'
required: true
type: string


jobs:
post-to-medium:
Expand All @@ -24,10 +29,10 @@ jobs:
uses: philips-software/post-to-medium-action@v0.6.0
with:
integration_token: "${{ secrets.MEDIUM_TOKEN }}"
file: "${{ inputs.file }}"
file: "blog/${{ inputs.folder }}/index.medium"
content_format: "markdown"
notify_followers: "false"
tags: "test,tag"
tags: "${{ inputs.tags }}"
title: ${{ inputs.title }}
license: "all-rights-reserved"
publish_status: "draft"
publish_status: "public"
31 changes: 31 additions & 0 deletions README.md
Expand Up @@ -28,8 +28,39 @@ This command generates static content into the `build` directory and can be serv
- **Auto-generated Website:** [Docusaurus](https://docusaurus.io/) to create static files for a modern blog UI
- **Linter:** pre-commit hook to enforce consistent Markdown formatting
- **Medium Publishing:** GitHub Actions workflow to publish articles to Medium account
- **Dev.to Publishing:** GitHub Actions workflow to publish articles to Dev.to account

## Specifications

- Launched: March 2023
- Link: https://spencerlepine.github.io/blog

## Development

### Dev.to Articles

- [ ] building-a-readme-crawler-with-node-js
- [ ] building-llama-as-a-service
- [ ] creating-custom-git-commands
- [ ] git-project-configuration-with-husky-and-eslint
- [ ] manyshiba-the-worlds-greatest-twitter-bot
- [ ] portfolio-site-continuous-integration-github-action
- [ ] preparing-for-my-amazon-front-end-engineer-interview
- [ ] quickly-open-github-repo-in-browser-from-terminal
- [ ] software-engineering-workflow
- [ ] typescript-development-set-up-for-vscode
- [ ] what-i-learned-during-100-days-of-code

### Medium Articles

- [x] building-a-readme-crawler-with-node-js
- [ ] building-llama-as-a-service
- [x] creating-custom-git-commands
- [ ] git-project-configuration-with-husky-and-eslint
- [ ] manyshiba-the-worlds-greatest-twitter-bot
- [ ] portfolio-site-continuous-integration-github-action
- [ ] preparing-for-my-amazon-front-end-engineer-interview
- [x] quickly-open-github-repo-in-browser-from-terminal
- [x] software-engineering-workflow
- [x] typescript-development-set-up-for-vscode
- [x] what-i-learned-during-100-days-of-code
Expand Up @@ -3,7 +3,7 @@ title: Building a README Crawler With Node.js
slug: building-a-web-crawler-with-node-js
tags: [GitHub, Repositories, WebCrawler, Node.js]
authors: [spencerlepine]
date: 2021-08-14
date: 2021-08-14T12:00
---

![Blog Post Thumbnail](./thumbnail.jpg)
Expand Down
2 changes: 1 addition & 1 deletion blog/building-llama-as-a-service/index.md
Expand Up @@ -3,7 +3,7 @@ title: Building Llama as a Service (LaaS)
slug: building-llama-as-a-service
tags: [Express, Docker, MongoDB, Node.js, Heroku, GitHub Actions]
authors: [spencerlepine]
date: 2022-07-12
date: 2022-07-12T12:00
---

![Blog Post Thumbnail](./thumbnail.jpg)
Expand Down
62 changes: 62 additions & 0 deletions blog/creating-custom-git-commands/index.devto
@@ -0,0 +1,62 @@
---
title: Creating Custom Git Commands2
description: Creating custom Git commands to help automate git workflow. # Dev.to
tags: 'git, terminal, commands' # Dev.to (Max 3)
canonical_url: null # Dev.to
---

![Blog Post Thumbnail](./thumbnail.jpg)

Every time I clone a repository from GitHub, I always run the same set of commands. This is prone to typos and simply inconvenient. There is a simple solution of combining each step into a single command that automatically runs everything for us.

In this example, I need to clone a GitHub repository, move into the new directory, and then open the project in VSCode.

Instead of multiple commands:
```sh
git clone https://github.com/spencerlepine/readme-crawler
cd readme-crawler
code .
```
It would great to run one command:
```sh
clone https://github.com/spencerlepine/readme-crawler
```

To achieve this, we can create a script in the ```~/bin``` directory. Make sure this path matches up with your configuration for the terminal (e.g. ```PATH=$PATH:$HOME/bin```).

Let’s create a custom script to combine the git commands.

```sh
#!/bin/bash

((!$#)) && echo missing git URL argument! && exit 1

git clone $1
basename=$(basename $1)
reponame=${basename%.*}
cd $reponame
npm install
code .
```

Use this script or create your own, and follow these steps to set up the custom command:

- Navigate to usr/local/bin -> ```cd ~/../../usr/local/bin```
- Run ```vim clone```
- *Paste the script*
- Save the file:
- *press ‘ESC’
- *press ‘SHIFT’ + ‘:’
- *type ‘wq’ + ENTER
- Create an executable
- ```chmod +x clone```
- Run the command!
- ```clone https://github.com/spencerlepine/manyshiba-bot.git```

Viola! This script will accept one command line argument of the destination repo URL. It will automatically open the new project in VSCode in one command.

Also find me here:
- [Twitter](https://twitter.com/SpencerLepine)
- [GitHub](https://github.com/spencerlepine)
- [LinkedIn](https://www.linkedin.com/in/spencer-lepine/)
- [YouTube](https://www.youtube.com/channel/UCBL6vAHJZqUlyJp-rcFU55Q)
7 changes: 4 additions & 3 deletions blog/creating-custom-git-commands/index.md
@@ -1,9 +1,10 @@
---
title: Creating Custom Git Commands
title: Creating Custom Git Commands2
description: Creating custom Git commands to help automate git workflow. # Dev.to
slug: creating-custom-git-commands
tags: [Git, Scripts, Terminal, Commands, GitHub]
tags: [Git, Scripts, Terminal, Commands, GitHub] # Docusaurus
authors: [spencerlepine]
date: 2021-08-15
date: 2021-08-15T12:00
---

![Blog Post Thumbnail](./thumbnail.jpg)
Expand Down
61 changes: 61 additions & 0 deletions blog/creating-custom-git-commands/index.medium
@@ -0,0 +1,61 @@
---
title: Creating Custom Git Commands
description: Creating custom Git commands to help automate git workflow.
publish_status: "draft"
---

![Blog Post Thumbnail](./thumbnail.jpg)

Every time I clone a repository from GitHub, I always run the same set of commands. This is prone to typos and simply inconvenient. There is a simple solution of combining each step into a single command that automatically runs everything for us.

In this example, I need to clone a GitHub repository, move into the new directory, and then open the project in VSCode.

Instead of multiple commands:
```sh
git clone https://github.com/spencerlepine/readme-crawler
cd readme-crawler
code .
```
It would great to run one command:
```sh
clone https://github.com/spencerlepine/readme-crawler
```

To achieve this, we can create a script in the ```~/bin``` directory. Make sure this path matches up with your configuration for the terminal (e.g. ```PATH=$PATH:$HOME/bin```).

Let’s create a custom script to combine the git commands.

```sh
#!/bin/bash

((!$#)) && echo missing git URL argument! && exit 1

git clone $1
basename=$(basename $1)
reponame=${basename%.*}
cd $reponame
npm install
code .
```

Use this script or create your own, and follow these steps to set up the custom command:

- Navigate to usr/local/bin -> ```cd ~/../../usr/local/bin```
- Run ```vim clone```
- *Paste the script*
- Save the file:
- *press ‘ESC’
- *press ‘SHIFT’ + ‘:’
- *type ‘wq’ + ENTER
- Create an executable
- ```chmod +x clone```
- Run the command!
- ```clone https://github.com/spencerlepine/manyshiba-bot.git```

Viola! This script will accept one command line argument of the destination repo URL. It will automatically open the new project in VSCode in one command.

Also find me here:
- [Twitter](https://twitter.com/SpencerLepine)
- [GitHub](https://github.com/spencerlepine)
- [LinkedIn](https://www.linkedin.com/in/spencer-lepine/)
- [YouTube](https://www.youtube.com/channel/UCBL6vAHJZqUlyJp-rcFU55Q)
Expand Up @@ -3,7 +3,7 @@ title: Git Project Configuration With Husky and ESLint
slug: git-project-configuration-with-husky-and-eslint
tags: [Git, Husky, ESLint, Workflow, GitHub]
authors: [spencerlepine]
date: 2022-03-20
date: 2022-03-20T12:00
---

![Blog Post Thumbnail](./thumbnail.jpg)
Expand Down
Expand Up @@ -3,7 +3,7 @@ title: ManyShiba - The World's Greatest Twitter Bot
slug: manyshiba-the-worlds-greatest-twitter-bot
tags: [GitHub, Twitter, Node.js. Bot]
authors: [spencerlepine]
date: 2021-09-01
date: 2021-09-01T12:00
---

![Blog Post Thumbnail](./thumbnail.jpg)
Expand Down
Expand Up @@ -3,7 +3,7 @@ title: Portfolio Site Continuous Integration GitHub Action
slug: portfolio-site-continuous-integration-github-action
tags: [GitHub, Actions, Repositories, ssh, Ubuntu, DigitalOcean]
authors: [spencerlepine]
date: 2021-10-11
date: 2021-10-11T12:00
---

![Blog Post Thumbnail](./thumbnail.jpg)
Expand Down
Expand Up @@ -3,7 +3,7 @@ title: Preparing for My Amazon Front End Engineer Interview
slug: preparing-for-my-amazon-front-end-engineer-interview
tags: [Job Search, Amazon, AWS, LeetCode, Interviews]
authors: [spencerlepine]
date: 2022-11-20
date: 2022-11-20T12:00
---

![Blog Post Thumbnail](./thumbnail.jpg)
Expand Down
Expand Up @@ -3,7 +3,7 @@ title: Quickly Open GitHub Repo in Browser From Terminal
slug: quickly-open-github-repo-in-browser-from-terminal
tags: [Git, Workflow, GitHub, Scripts, Terminal, Commands]
authors: [spencerlepine]
date: 2022-10-22
date: 2022-10-22T12:00
---

![Blog Post Thumbnail](./thumbnail.jpg)
Expand Down
Expand Up @@ -3,7 +3,7 @@ title: Software Engineering Workflow
slug: software-engineering-workflow
tags: [Workflow, Tools, Software Engineer]
authors: [spencerlepine]
date: 2021-08-13
date: 2021-08-13T12:00
---

![Blog Post Thumbnail](./thumbnail.jpg)
Expand Down
Expand Up @@ -3,7 +3,7 @@ title: TypeScript Development Set Up for VSCode
slug: typescript-development-set-up-for-vscode
tags: [Workflow, VSCode, TypeScript]
authors: [spencerlepine]
date: 2022-10-24
date: 2022-10-24T12:00
---

![](./thumbnail.jpg)
Expand Down
Expand Up @@ -3,7 +3,7 @@ title: What I Learned During 100DaysOfCode
slug: what-i-learned-during-100-days-of-code
tags: [Git, Scripts, Terminal, Commands, GitHub]
authors: [spencerlepine]
date: 2021-06-26
date: 2021-06-26T12:00
---

![Blog Post Thumbnail](./thumbnail.jpg)
Expand Down
3 changes: 2 additions & 1 deletion docusaurus.config.js
Expand Up @@ -39,6 +39,7 @@ const config = {
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: false, // Optional: disable the docs plugin
blog: {
routeBasePath: '/',
showReadingTime: true,
Expand Down Expand Up @@ -81,7 +82,7 @@ const config = {
],
},
{
title: 'Profiles',
title: 'Socials',
items: [
{
label: 'Portfolio',
Expand Down

0 comments on commit f9bc459

Please sign in to comment.