-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: workflow to publish articles to Dev.to
- Loading branch information
1 parent
845d704
commit f9bc459
Showing
19 changed files
with
214 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: GitHub Pages Deploy | ||
name: "[Deploy] GitHub Pages" | ||
|
||
on: | ||
workflow_dispatch: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters