ăŻăăăŤ
ĺťĺš´ DEV ăŽă˘ăŤăŚăłăăä˝ćăăăăŽăŽăäťăžă§ĺ ¨ăćĺšć´ťç¨ĺşćĽăŚăăžăăă§ăăă
DEV ăŤăŻ ăŤăăăŤăŤ URL ăč¨ĺŽĺşćĽăăŽă§ă常ă Zenn ăŽč¨äşăć稿ăăéăŤăŻăăšăăšăăăăăŞă¨čăăŚăăăžăăăăăă§ăZenn ăŤč¨äşăć稿ăăăăčŞĺç㍠DEV ăŤăč¨äşăć稿 & ĺćăă GitHub Actions ăä˝ăŁăŚăżăžăăă
https://github.com/nikaera/sync-zenn-with-dev-action
äťĺĺă㌠GitHub Actions ăčŞä˝ăăăŽă§ăăăăăŽä¸ă§ĺžăçĽčŚăćŽă形ă§č¨äşăć¸ăăă¨ăŤăăžăăăăžăăGitHub Actions 㯠TypeScript ă§ä˝ćăăžăăă
éçşăă GitHub Actions ăŽćŚčŚ
ăžăăŻăśăă¨ăŠăŽăă㪠GitHub Actions ăä˝ćăăăŽăăćŚčŚăŤă¤ăăŚčŞŹćăăăăžăă
GitHub ăŞăă¸ăăŞă§çŽĄçăăŚăă Zenn ăŽč¨äşă DEV ăŤĺćăăŚć稿ăă GitHub Actions ăä˝ćăăžăăă ăăŽé㍠DEV ă¸ć稿ăăč¨äşăŤăŻ Zenn ăŽčŠ˛ĺ˝č¨äşă¸ăŽăŤăăăŤăŤ URL ăčŞĺă§č¨ĺŽă§ăăžăăăăăŤăă DEV 㨠Zenn ă¸č¨äşăăˇăźă ăŹăšăŤăŻăăšăăšăăăăă¨ăĺŻč˝ă¨ăŞăăžăă
äťĺä˝ćăă GitHub Actions ăĺŠç¨ăăăŻăźăŻăăăźăăĄă¤ăŤăŽä¸äžăŻä¸č¨ă¨ăŞăăžăă
# .github/workflows/sync-zenn-with-dev-all.yml
name: "Sync all Zenn articles to DEV"
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout my project
uses: actions/checkout@v2
- name: dev.to action step
uses: nikaera/sync-zenn-with-dev-action@v1
# id ăč¨ĺŽăăăă¨ă§ăĺžăŽă¸ă§ă㧠Output ă§ćĺŽăăĺ¤ăĺç
§ĺŻč˝ăŤăŞă
id: dev-to
with:
# DEV ㎠API ăăźăćĺŽăă
api_key: ${{ secrets.api_key }}
# (ăŞăăˇă§ăł) DEV ăŤč¨äşăć稿ăăé㍠Zenn ăŽăŤăăăŤăŤ URL ăč¨ĺŽăăăĺ ´ĺăŤćĺŽăă
# username: nikaera
# (ăŞăăˇă§ăł) ćščĄĺşĺăă§ćĺŽăă articles ăăŠăŤăĺ
ăŽăăĄă¤ăŤăăšăč¨čźăă txt ăăĄă¤ăŤăćĺŽăăăă¨ă§ăč¨čźăăăč¨äşăŽăżăĺćăăăăăŤăŞăă
# äťăăŠă°ă¤ăłă¨çľăżĺăăăăă¨ă§ĺˇŽĺăŽăżă txt ăăĄă¤ăŤăŤčźăăăă¨ăĺŻč˝ă芳細ăŤă¤ăăŚăŻĺžčż°ăŽ Outputs ăŽé
çŽăŤč¨čźă
# added_modified_filepath: ./added_modified.txt
# (ăŞăăˇă§ăł) Zenn ㎠articles 䝼ä¸ĺ
¨ăŚăŽč¨äşă常㍠DEV ăŤĺćăăăćĺŽăă
# update_all ă true ăŽă¨ă㯠added_modified_filepath ăŻçĄčŚăăăă
# update_all: false
# ä¸č¨ă˘ăŻăˇă§ăłĺŽčĄć㍠DEV ăŤć°čŚă§ĺćăăč¨äşăŤé˘ăăŚăŻ Zenn ăŽăăźăŻăăŚăłăăăăŤ
# 芲ĺ˝ăă DEV ăŽč¨äşăŽ ID ă dev_article_id ă¨ăăŚč¨čźăăăăăăŤăŞăă
# äťĺžăŻă㎠ID ăĺ
ăŤĺćăăăăăŤăŞăăăă芲ĺ˝ăă Zenn ăŽč¨äşăăłăăăăăă
# ć°čŚă§ĺćăăč¨äşăçĄăăă°ăăăŽă¸ă§ăăŻĺŽčĄăăŞăă
- name: write article id of DEV to articles of Zenn.
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add ${{ steps.dev-to.outputs.newly-sync-articles }}
git commit -m "sync: Zenn with DEV [skip ci]"
git push
if: steps.dev-to.outputs.newly-sync-articles
# Outputs ăŤăŻ DEV ăŽč¨äşć
ĺ ą (title, url) ăĺŤăžăăăăăŤăŞăăăă
# ćĺžăŤĺşĺăăŚĺŽčĄçľćăŽĺ
厚ă確čŞăăăă¨ăă§ăă
- name: Get the output articles.
# dev-to ă¨ăă id ăç´äťăăă¸ă§ă㎠Outputs ăĺĺžă㌠echo ă§ĺ
厚ăĺşĺăă
run: echo "${{ steps.dev-to.outputs.articles }}"
ç°Ąĺ㍠nikaera/sync-zenn-with-dev-action@v1
ă¨ăăă¸ă§ăăŽĺ
é¨ĺŚçăŤă¤ăăŚčŞŹćăăăăžăă
- Inputs ăŽ
update_all
ĺăładded_modified_filepath
ă§ĺăĺăŁăć ĺ ąăĺ ăŤă ăŠăŽč¨äşă DEV ăŤĺćăăăăĺ¤ĺŽăă - DEV ăŤĺćăăč¨äşăŽăăĄă¤ăŤăăšä¸čŚ§ăĺĺžăăŚă
ăăăăăŽč¨äşăŽăăăăŤ
dev_article_id
ăŽč¨čźăăăăĺ¤ĺŽăă - Inputs ăŽ
api_key
ăĺŠç¨ăăŚăZenn ăŽč¨äşăŤdev_article_id
ăĺŤăžăăŚăăă°ă 芲ĺ˝ăă DEV ăŽč¨äşăć´ć°ăăăĺŤăžăăŚăăŞăăă° DEV ăŤć°čŚă§č¨äşăä˝ćăă - Inputs ăŽ
username
ăĺŠç¨ăăŚă DEV ăŽč¨äşăŤčŠ˛ĺ˝ăă Zenn č¨äşăŽăŤăăăŤăŤ URL ăč¨ĺŽăă - DEV ăŤć°čŚă§č¨äşăä˝ćăăĺ ´ĺăŻă
Zenn ăŽčŠ˛ĺ˝č¨äşăŽăăăăŤ
dev_article_id
ăć¸ăčžźă - DEV ăŤč¨äşăć稿ăăéăZenn ăŻĺŻžĺżăăŚăăăă
DEV ă§ăŻĺŻžĺżăăŚăăŞăč¨čż°ăŻĺé¤ăă (
:::
č¨ćłăä¸é¨ăŽăłăźăč¨ćł) - č¨äşăŽĺ Źéăšăăźăżăšĺăłăżă°ăŞăŠăŤă¤ăăŚă DEV ăŽč¨äşăŤĺć ăă1
- ć°čŚă§ DEV ăŤč¨äşăĺćăă Zenn č¨äşăŽăăĄă¤ăŤăăšăă
Outputs ăŽ
newly-sync-articles
ăŤč¨ĺŽăă (ĺžăŽă¸ă§ăă§dev_article_id
ăŽĺŤăžăăč¨äşăăłăăăăăăăă) - ăŻăźăŻăăăźă§ĺćăăăč¨äşć
ĺ ąăŻ Outouts ăŽ
articles
ăŤč¨ĺŽăă
Inputs 㨠Outputs ăŽĺ 厚ä¸čŚ§ăŤă¤ăăŚăŻä¸č¨ăŤăŞăăžăă
Inputs
ăăź | 誏ć | ĺż é |
---|---|---|
api_key | DEV ㎠API Key ăč¨ĺŽăă | o |
username | Zenn ㎠čŞĺăŽă˘ăŤăŚăłăĺ ăč¨ĺŽăă (DEV ăŤĺćăăč¨äşăŤ Zenn ăŽăŤăăăŤăŤ URL ăč¨ĺŽăăăĺ ´ĺăŽăż) | x |
added_modified_filepath | ćščĄĺşĺăă§ćĺŽăă articles ăăŠăŤăĺ ăŽăăĄă¤ăŤăăšăč¨čźăă txt ăăĄă¤ăŤăćĺŽăăăă¨ă§ăč¨čźăăăč¨äşăŽăżăĺćăăăăăŤăŞăăPR ăăłăăă塎ĺăŽăăĄă¤ăŤăŽăżăĺĺžăăăă㎠GitHub Actions jitterbit/get-changed-files@v1 ă¨çľăżĺăăăăă¨ă§ăć´ć°ĺˇŽĺăŽăăŁăč¨äşăŽăżăéćĺćăăăă¨ăĺŻč˝ă2 ć´ć°ĺˇŽĺăŽăăŁăč¨äşăŽăżăéćĺćăăăăăŽĺŽéăŽăŻăźăŻăăăźăăĄă¤ăŤăŻăăĄă | x |
update_all | Zenn ăŽĺ
¨ăŚăŽč¨äşăăŠăăăăăăŠăăăč¨ĺŽăăăGitHub Actions ĺĺĺŽčĄćăŽăż true ăŤăă使ăćšăćłĺŽăăŚăăăăăăŠăŤă㯠trueăadded_modified_filepath ăăă update_all ăĺŞĺ
ăăăăă added_modified_filepath ăč¨ĺŽăăĺ ´ĺ㯠false ăč¨ĺŽăăĺż
čŚăă` | x |
Outputs
ăăź | 誏ć |
---|---|
articles | ĺćăăă DEV ăŽč¨äşăŽăżă¤ăăŤĺăł URL ăć źç´ăăăé ĺ |
newly-sync-articles | DEV ă§ć°ăăŤć°čŚä˝ćăăă Zenn č¨äşăŽăăĄă¤ăŤăăšăć źç´ăăăé ĺăĺŽéăŽăŻăźăŻăăăźăăĄă¤ăŤăŽčŠ˛ĺ˝ăăč¨čż°ăŽăăăŤăĺż ăăłăăăăŤĺŤăăăăăŤăăĺż čŚăăă (ççąăŻĺžčż°) |
Inputs ĺăł Outputs ăŤă¤ăăŚăŻĺ Źĺźăľă¤ăăŽčŞŹćăăĺç §ăă ăăă
Zenn ăŽč¨äşă DEV ăŤĺćăăăăăŽäťçľăż
Zenn ăŽč¨äşăć°čŚă§ DEV ăŤĺćăăéăŻăDEV ăŤč¨äşăć°čŚä˝ćăăĺż čŚăăăăžăăăăŽé㍠Zenn ăŽč¨äşă¨ DEV ăŽč¨äşăç´äťăăăăăŽä˝ăăăŽäťçľăżăĺż čŚă¨ăŞăăžăăăăăăŞăă¨ăäťĺž Zenn ăŽč¨äşĺ 厚ăć´ć°ăăéăŤăDEV ăŽăŠăŽč¨äşăŤĺ 厚ăĺćăăăă°ăăăăä¸ćăŞăăă§ăă
ăăă§ăč¨äşăĺćăăăăăŽäťçľăżă¨ăăŚădev_article_id
ă¨ăăăăŁăźăŤăă Zenn ăŽăăźăŻăăŚăłăăăăŤčż˝č¨ăăăă¨ă§ DEV ăŽĺćăăšăč¨äşă¨ăŽç´äťăăčĄăăă¨ăŤăăžăăădev_article_id
ăŤăŻ DEV ăŽč¨äşä˝ć API ĺŽčĄćăŽčżăĺ¤ă§ăă id
ăč¨ĺŽăăžăă
ä¸ĺşŚ id
ă dev_article_id
ă¨ă㌠Zenn ăŽč¨äşăŤç´äťăăŚăăžăă°ă揥ĺ䝼éăŤč¨äşăŽĺćăčĄăé㯠DEV ăŽč¨äşć´ć° API ăĺŠç¨ă§ăăžăă
ăžăăOutputs ㎠newly-sync-articles
ăŤăŻć°čŚă§ä˝ćăăă DEV č¨äşăŽ id
ă§ăă dev_article_id
ăčż˝č¨ăăă Zenn č¨äşăŽăăĄă¤ăŤăăšăć źç´ăăăŚăăžăăăăŽăăănikaera/sync-zenn-with-dev-action@v1
ĺŽčĄĺžăŻăä¸č¨ăŽăă㍠steps.dev-to.outputs.newly-sync-articles
ĺ
ăŤć źç´ăăăăăĄă¤ăŤçž¤ăăłăăăăŤĺć ăăăĺż
čŚăăăăžăă
# `nikaera/sync-zenn-with-dev-action@v1` ĺŽčĄĺžăŤĺż
ăĺŽçžŠăăšăă¸ă§ă
# DEV ăŤć°čŚăŤä˝ćăăč¨äşăăŞăăă°ĺŽčĄăăŞă (if: steps.dev-to.outputs.newly-sync-articles)
- name: write article id of DEV to articles of Zenn.
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add ${{ steps.dev-to.outputs.newly-sync-articles }}
git commit -m "sync: Zenn with DEV [skip ci]"
git push
if: steps.dev-to.outputs.newly-sync-articles
ä¸č¨ăŽă¸ă§ă㧠newly-sync-articles
ăŤć źç´ăăă dev_article_id
ăčż˝č¨ăăă Zenn č¨äşăŻéćăłăăăăŤĺć ăăŞăă¨ăZenn ăŽĺ
¨ăŚăŽč¨äşăĺććŻ DEV ăŤć°čŚä˝ćăăçśăăă¨ăăä¸ĺ
ˇĺăĺźă辡ăăăŚăăžăăŽă§ăă注ćăă ăă
GitHub Actions ăéçşăăćé
ăľăŻăă¨éçşăŤĺăçľăżăăăŁăăăăDocker ăłăłăăăĺŠç¨ăăćšćł ă§ăŻăŞăăJavaScript ăĺŠç¨ăăćšćł ă§éçşăé˛ăăŚăăăă¨ăŤăăžăăă
TypeScript 㧠GitHub Actions ăä˝ă
GitHub ĺ Źĺźă TypeScript 㧠GitHub Actions ăä˝ăăă㎠ăăłăăŹăźăăăă¸ă§ăŻă ăç¨ćăăŚăăăŚăăžăăäťĺăŻăăŽăăłăăŹăźăăăă¸ă§ăŻăăĺŠç¨ăă形ă§ăăă¸ă§ăŻăăä˝ćăăžăăă
(ä˝čŤ) GitHub Actions ă§ăŻ Docker ăłăłăă ăç¨ăăŚăŻăźăŻăăăźăĺŽčĄĺŻč˝ă§ăăăăŽăăăĺŽčĄç°ĺ˘ăŻčŞçąăŤč¨ĺŽĺşćĽăžăă(Go, Python, Ruby, etc.)
ćŠé TypeScript ăŽăăłăăŹăźăăăă¸ă§ăŻăăĺ ăŤčŞĺ㎠GitHub Actions ăăă¸ă§ăŻăăä˝ćăăžăă
1. ăăłăăŹăźăăăă¸ă§ăŻăăĺ ㍠GitHub Actions ㎠TypeScript ăăă¸ă§ăŻăăä˝ćăă
2. ăăă¸ă§ăŻăăŽä˝ćĺž git clone
ăăŚăăŚéçşăăćşĺăć´ăă
GitHub Actions ăăă¸ă§ăŻăăŽéçşăé˛ăăăăăŽćşĺăčĄă
ăăłăăŹăźăăăă¸ă§ăŻăă git clone
ăăăăăžă㯠action.yml
ăŽĺ
厚ăĺ¤ć´ăăžăă
äťĺä˝ćăă GitHub Actions ㎠action.yml
ăŻä¸č¨ă¨ăŞăŁăŚăăăžăă
# action.yml
# GitHub Actions ăŽăăă¸ă§ăŻăĺ
name: "Sync Zenn articles to DEV"
# GitHub Actions ăŽăăă¸ă§ăŻă誏ćć
description: "Just sync Zenn articles to DEV."
# GitHub Actions ăŽä˝č
author: "nikaera"
# GitHub Actions ăŤć¸Ąăăĺźć°ăŽĺ¤ĺŽçžŠ
inputs:
api_key:
# ăăŁăźăŤăăŽćĺŽăĺż
é ă§ăăă° trueăĺż
é ă§ăŞăăă° false ăč¨ĺŽăă
# DEV ㎠API ăăźăŻĺćăčĄăéăŤĺż
é ăŞăăătrue ăč¨ĺŽăăŚăă
required: true
# ăăŁăźăŤăăŽčŞŹćć
description: "The api_key required to use the DEV API (https://docs.forem.com/api/#section/Authentication)"
username:
required: false
description: "Zenn user's account name. (Fields to be filled in if canonical url is set.)"
articles:
required: false
description: "The directory where Zenn articles are stored."
# ăăŁăźăŤăăŤăŻăăăŠăŤăĺ¤ăćĺŽăăăă¨ăĺŻč˝
# Zenn ăŽč¨äşăăăăŠă§ć źç´ăăăŚăăăăŠăŤăĺăćĺŽăăŚăă
default: articles
update_all:
require: false
description: "Whether to synchronize all articles."
default: true
added_modified_filepath:
required: false
description: |
Synchronize only the articles in the file path divided by line breaks.
You can use jitterbit/get-changed-files@v1 to get only the file paths of articles that have changed in the correct format.
(https://github.com/jitterbit/get-changed-files)
# GitHub Actions ĺŽčĄĺžăŤĺç
§ĺŻč˝ăŤăŞăĺ¤ĺŽçžŠ
outputs:
articles:
description: "A list of URLs of dev.to articles that have been created or updated"
newly-sync-articles:
description: "File path list of newly synchronized articles."
# GitHub Actions ăŽĺŽčĄç°ĺ˘
runs:
using: "node12"
# ăăłăăŹăźăăăă¸ă§ăŻăă§ăŻ ăłăłăă¤ăŤĺ
ă dist ăŤăŞăăă `dist/index.js` ăćĺŽăăŚăă
main: "dist/index.js"
TypeScript ăŽăăłăăŹăźăăăă¸ă§ăŻăă§ăŻăăăłăăŤăăźăŤă¨ă㌠ncc
ăćĄç¨ăăăŚăăžăăGitHub Actions ĺŽčĄćăŤä˝żç¨ăăăăŽăŻ ncc ăŤăăăłăłăă¤ăŤăăăĺä¸ăŽ JavaScript ăăĄă¤ăŤ (dist/index.js
) ăŤăŞăăžăă
ăă¨ăŻ src
ăăŠăŤăĺ
ă§ăăă°ăŠă ăć¸ăăŚănpm run all && node dist/index.js
ăŽăăăŤăłăăłăĺŽčĄăăŞăăéçşăé˛ăăŚăăă ăă§ăă
(ä˝čŤ) GitHub Actions ăŽéçşăăźăŤă¨ă㌠Docker ăĺŠç¨ăă act
ă¨ăăăăŽăĺĺ¨ăăăăă§ăăăăźăŤăŤç°ĺ˘ă§ć¤č¨źăăé㯠ć˘çĽăŽĺéĄ ăŤĺŻžĺżăăĺż
čŚăăăăăă§ăăăGitHub Actions ăŽéçşă§é常ăŤćĺšć´ťç¨ă§ăăăă§ć°ăŤăŞăŁăŚăăăžăă
äťĺăŽéçşă§ăŻĺŠç¨ăăŞăăŁăăŽă§ăăăäťĺžéçşăé˛ăăŚăăä¸ă§ĺŠç¨ăăćŠäźăĺşăŚăăăăŞăŽă§ăăăŽéăŻćŹč¨äşĺ 厚ăć´ć°ăă形ă§çĽčŚăčż˝č¨ăăăă¨čăăŚăăăžăă
GitHub Actions ăĺŽčŁ ăăéăŤĺŠç¨ăăćŠč˝
GitHub Actions ăĺŽčŁ ăăéăŤĺŠç¨ăăćŠč˝ăăĺŽéăŽăłăźăĺ 厚ăćç˛ăăŚç°ĄĺăŤčŞŹćăăŚăăăžăăä¸č¨ă§ç´šäťăăĺ 厚㯠GitHub Actions Toolkit ăŽćŠč˝ă§ăă
// main.ts
/**
ä¸č¨ăŽ yml ㎠with ă§ćĺŽăăĺ¤ăŻ core.getInput ă§ĺăĺăăă¨ăĺŻč˝ă
- name: dev.to action step
uses: nikaera/sync-zenn-with-dev-action@v1
id: dev-to
with:
# DEV ㎠API ăăźăćĺŽăă
api_key: ${{ secrets.api_key }}
*/
core.getInput("api_key", { required: true });
core.getInput("update_all", { required: false });
/**
ä¸č¨ăŽ yml ㎠steps.<ă¸ă§ăă§ćĺŽăă id>.outputs ă§ĺç
§ĺŻč˝ăŞĺ¤ăăťăăăăăă¨ăĺŻč˝ă
ăťăăăăĺ
厚ăŻćĺĺă§ăăĺż
čŚăăăă
- name: dev.to action step
uses: nikaera/sync-zenn-with-dev-action@v1
id: dev-to
- name: Get the output articles.
run: echo "${{ steps.dev-to.outputs.articles }}"
*/
core.setOutput("articles", JSON.stringify(devtoArticles, undefined, 2));
core.setOutput("newly-sync-articles", newlySyncedArticles.join(" "));
/**
GitHub Actions ĺŽčĄćăŤĺşĺăăăăă°ăăŹăăŤăă¨ăŤĺşĺăăăă¨ăĺŻč˝
core.debug ăŻăăźăŤăŤĺŽčĄćăŽăżăŤĺşĺĺ
厚ă確čŞăăăă¨ăă§ăă
*/
core.debug("debug");
core.info(`update_all: ${updateAll}`);
core.error(JSON.stringify(error));
ä¸č¨ă ăććĄăăŚăă° GitHub Actions ăŽéçşăŻĺéĄăŞăčĄăăă¨ăă§ăăžăăă
ä˝ćăă GitHub Actions ăĺŽé㍠GitHub ä¸ă§ĺŽčĄĺŻč˝ăŤăă
ăăźăŤăŤç°ĺ˘ă§ä¸éăéçşăĺŽäşăăăăGitHub ăŞăă¸ăăŞăŤ push ăăĺžăżă°äťăăčĄăăžăăGitHub Actions ăŻăżă°ăč¨ĺŽăăŞăă¨ĺŽčĄă§ăăŞăăăĺż čŚăŞä˝ćĽă¨ăŞăăžăă äťĺăżă°äťă㯠GitHub ä¸ă§čĄăăžăăă
1. ăżă°ăŽé çŽăăŻăŞăăŻăă
2. Create a new release
ăăżăłăăŻăŞăăŻăăŚăżă°ä˝ćçťé˘ăŤéˇç§ťăă
3. Publish release
ăăżăłăăŻăŞăăŻăăŚăżă°ăŽä˝ćăĺŽäşăă
ä¸č¨ăŽäžă§ăŻ v1
ă¨ăăăżă°ăä˝ćăăăŽă§ nikaera/sync-zenn-with-dev-action@v1
ăŽăăăŞč¨čż°ă§ GitHub Actions ăĺŠç¨ĺŻč˝ăŤăŞăăžăăă ç§ăŻ Zenn ăŽč¨äşă zenn.dev
ă¨ăăăŞăă¸ăăŞă§çŽĄçăăŚăăăăăćŠéăăŽăŞăă¸ăăŞăŤ GitHub Actions ăĺ°ĺ
ĽăăŚăżăžăă
Zenn ăŽĺ ¨ăŚăŽč¨äşă DEV ăŤĺćăăăăăŽăŻăźăŻăăăź
ćŹč¨äşăŽ GitHub Actions ă§ăŻ DEV ㎠API ăăźă使ç¨ăăăăăäşĺăŤăˇăźăŻăŹăă㸠API_KEY
ă¨ăăĺ称ă§ĺ¤ăçťé˛ăăŚăăăžăăĺ
Źĺźăľă¤ăăŽćé ăŤĺžă ăˇăźăŻăŹăăăŽçťé˛ăĺŽäşăăăă芲ĺ˝ăŞăă¸ăăŞăŤ .github/workflows/sync-zenn-with-dev-all.yml
ă¨ăăăŻăźăŻăăăźăăĄă¤ăŤăä˝ćăăžăă
# .github/workflows/sync-zenn-with-dev-all.yml
name: "Sync-All Zenn with DEV"
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
if: contains(github.event.head_commit.message, '[skip ci]') == false
steps:
- name: setup node project
uses: actions/checkout@v2
- name: dev.to action step
uses: nikaera/sync-zenn-with-dev-action@v1
id: dev-to
with:
api_key: ${{ secrets.api_key }}
# Zenn ăŽčŞĺăŽă˘ăŤăŚăłăĺăćĺŽăăă¨
# DEV č¨äşăŽăŤăăăŤăŤ URL ㍠Zenn č¨äşăŽ URL ăćĺŽă§ăă
# username: nikaera
update_all: true
- name: write article id of DEV to articles of Zenn.
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add ${{ steps.dev-to.outputs.newly-sync-articles }}
git commit -m "sync: Zenn with DEV [skip ci]"
git push
if: steps.dev-to.outputs.newly-sync-articles
- name: Get the output articles.
run: echo "${{ steps.dev-to.outputs.articles }}"
ä¸č¨ăŻćĺĺŽčĄăĺŻč˝ăŞ Zenn ăŽč¨äşăĺ ¨ăŚ DEV ăŤĺćăăăăăŽăŻăźăŻăăăźăăĄă¤ăŤăŤăŞăăžăăä˝ćăĺŽäşăăăăŻăźăŻăăăźăăĄă¤ăŤăĺŽčĄăăŚăč¨äşăćŁĺ¸¸ăŤĺćă§ăăŚăăă確čŞăăŚăżăžăă
1. Actions
ăżăăăŻăŞăăŻăă
2. ä˝ćăă Sync-All Zenn with DEV
ăŻăźăŻăăăźăăĄă¤ăŤăé¸ćăă
3. Run workflow
ăăżăłăĺŽčĄăăŚăăŻăźăŻăăăźăĺŽčĄăă
4. ăŻăźăŻăăăźăŽĺŽčĄăćŁĺ¸¸ăŤĺŽäşăăŚăăă°ăăă°ăŤ DEV ăŽč¨äşć ĺ ąăĺşĺăăă
5. dev.to
ăŤă˘ăŻăťăšă㌠Zenn ăŽč¨äşć
ĺ ąăćŁĺ¸¸ăŤĺćăăăŚăăăă¨ă確čŞăă
ćŁĺ¸¸ăŤ Zenn ăŽĺ ¨ăŚăŽč¨äşă DEV ăŤĺćăăăŚăăăă¨ă確čŞă§ăăăă揥㯠Zenn ăŽč¨äşăć°čŚä˝ćăăăăăć´ć°ăăăă¨ăăŽăżăŤ DEV ăŤĺćăăăăăŽăŻăźăŻăăăźăăĄă¤ăŤăä˝ćăăžăă
ć´ć°ĺˇŽĺăŽăăŁă Zenn č¨äşăŽăżă DEV ăŤĺćăăăăăŽăŻăźăŻăăăź
main
ăăŠăłăăć´ć°ăăăă¨ăăŽăżć´ć°ăăăč¨äşăŽăżă DEV ăŤĺćăăăăăŽăŻăźăŻăăăźăăĄă¤ăŤăä˝ćăăžăă芲ĺ˝ăŞăă¸ăăŞăŤ .github/workflows/sync-zenn-with-dev.yml
ă¨ăăăŻăźăŻăăăźăăĄă¤ăŤăä˝ćăăžăă
# .github/workflows/sync-zenn-with-dev.yml
name: "Sync Zenn with DEV"
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
if: contains(github.event.head_commit.message, '[skip ci]') == false
steps:
- name: setup node project
uses: actions/checkout@v2
- name: get modified files
id: files
uses: jitterbit/get-changed-files@v1
- name: output modified files to text
run: |
for changed_file in ${{ steps.files.outputs.added_modified }}; do
echo "${changed_file}" >> added_modified.txt
done
- name: dev.to action step
uses: nikaera/sync-zenn-with-dev-action@v1
id: dev-to
with:
api_key: ${{ secrets.api_key }}
# Zenn ăŽčŞĺăŽă˘ăŤăŚăłăĺăćĺŽăăă¨
# DEV č¨äşăŽăŤăăăŤăŤ URL ㍠Zenn č¨äşăŽ URL ăćĺŽă§ăă
# username: nikaera
added_modified_filepath: ./added_modified.txt
update_all: false
- name: write article id of DEV to articles of Zenn.
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add ${{ steps.dev-to.outputs.newly-sync-articles }}
git commit -m "sync: Zenn with DEV [skip ci]"
git push
if: steps.dev-to.outputs.newly-sync-articles
- name: Get the output articles.
run: echo "${{ steps.dev-to.outputs.articles }}"
ä¸č¨ăŻăźăŻăăăźăăĄă¤ăŤăŽä˝ćăĺŽäşăăăăćŠéĺä˝ç˘şčŞăŽăăăŤăăžăăŤäťĺˇçä¸ăŽćŹč¨äşĺ 厚ăăŞăă¸ăăŞăŤ push ăăŚăżăžăă
1. git push
ĺžăŤčŠ˛ĺ˝ăăăŻăźăŻăăăźăŽĺŽčĄçľćă確čŞăă
2. dev.to
ăŤĺˇçéä¸ăŽĺ
厚ă§č¨äşăĺćăăăŚăăăă¨ă確čŞăă
ăăăžă§čŞŹćăăŚăă 2 ă¤ăŽăŻăźăŻăăăźăĺŠç¨ăăăă¨ă§ă大ćľăŽăŚăźăšăąăźăšăŻăŤăăźă§ăăăŻăă§ăă
ăăăăŤ
GitHub Actions ăŽĺ埡ăŽăăăŤĺăçľăă ăăă¸ă§ăŻăă§ăăăćăăŽĺ¤ćĽ˝ăăăŚäťăŤăč˛ă ăŞćŠč˝ăŽă˘ă¤ăă˘ăăăăŽă§éćĺŽčŁ ăăŚăăăăă¨čăăŚăăžăă(čąč¨ł, ăżă¤ăăŤăăŠăźăăăĺ¤ć´, etc.)
DEV ㍠Zenn ăŽč¨äşăăŻăăšăăšăăă GitHub Actions ăĺ Źéăăăă¨ă§ăăă¤ăăä¸čŠąăŤăŞăŁăŚăă Zenn ă¨ăăăăŠăăăăŠăźă ă澡ĺ¤ăŽćšăŤčŞçĽăăŚăăă ăăćŠäźăĺľĺşă§ăăăŽăăă¨čăăăăăłăˇă§ăłăä¸ăăŁăŚăăžăăă
ăăăŻăăŚăăăZenn ăŽč¨äşăäťă§ăćĺšć´ťç¨ăăăă㎠GitHub Actions ăéçşăăéăŤăŻăćăăćŹč¨äşă§ç´šäťăă GitHub Actions ăŽăłăźăăĺčăŤăŞăăŻăă§ăă
ăžăăGitHub Actions ㎠Marketplace ă¨ăăăăŽăç¨ćăăăŚăăăăăŞăŽă§ăéçşăăăç¨ĺşŚĺŽäşćŹĄçŹŹăăăĄăăŤçłčŤăăăŽă芌ăăŚăżăăă¨čăăŚăăăžăă
ĺčăŞăłăŻ
- DEV Community đŠâđťđ¨âđť
- dev.to supports canonical URLs so you can share content without impacting SEO... - DEV Community
- nikaera/sync-zenn-with-dev-action: Just sync Zenn articles to DEV.
- DEV API (beta)
- jitterbit/get-changed-files: Get all of the files changed/modified in a pull request or push’s commits.
- Docker ăłăłăăăŽă˘ăŻăˇă§ăłăä˝ćăă - GitHub Docs
- JavaScript ă˘ăŻăˇă§ăłăä˝ćăă - GitHub Docs
- actions/typescript-action: Create a TypeScript Action with tests, linting, workflow, publishing, and versioning
- vercel/ncc: Compile a Node.js project into a single file. Supports TypeScript, binary addons, dynamic requires.
- nektos/act: Run your GitHub Actions locally đ
- actions/toolkit: The GitHub ToolKit for developing GitHub Actions.
- ćĺˇĺăăăăˇăźăŻăŹăă - GitHub Docs
- DeepL ProďźăăăšăăŽäťăWord ăŞăŠăŽćć¸ăăťăăĽă˘ăŤçżťč¨ł
- Qiita
- Crieit - ăăă°ăŠăăźăăŻăŞă¨ă¤ăżăźăä˝ă§ăć°čť˝ăŤć¸ăăăłăăĽăăăŁ
DEV (Forem) ăŽäťć§ä¸ăăżă°ăŻć大ă§ă 4 ă¤ăžă§ăăč¨ĺŽă§ăăŞăăăăZenn ă§č¨ĺŽăăăżă°ăŽĺ é 4 ă¤ăžă§ DEV ăŽč¨äşăŤăŻč¨ĺŽăăŚăăžă ↩︎
ĺ˝çśă¨ăăă°ĺ˝çśă§ăă jitterbit/get-changed-files@v1 ăŻ
workflow_dispatch
ă§ăŻăźăŻăăăźăćĺĺŽčĄăăéăăforce push
çă§ăăĄă¤ăŤĺˇŽĺăćŁç˘şăŤçšĺŽă§ăăŞăćä˝ăŤăŻĺŻžĺżăăŚăăăžăăăŽă§ăăăŽĺ ´ĺăŻă¨ăŠăźăçşçăăžă ↩︎