Skip to content

Commit

Permalink
ci: add automatic posts to medium as draft [#3]
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Brilej committed Feb 12, 2023
1 parent c7fcca3 commit d97e3a0
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/push_to_medium.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: publish-to-medium
on: [push]

# https://github.com/InfraWay/post-medium-action
# https://andrew.red/posts/github-actions-ci-medium-post-action
jobs:
build:
runs-on: ubuntu-latest
steps:
- id: files
uses: jitterbit/get-changed-files@v1
- id: posts
name: Detecting posts from the changes
run: |
i=0
for changed_file in ${{ steps.files.outputs.added_modified }}; do
echo "Do something with ${changed_file}."
if [[ "${changed_file}" == "data/blog"* ]];
then
echo "File ${changed_file} matched post."
echo "::set-output name=post${i}::${changed_file}"
((i=i+1))
fi
done
- if: steps.posts.outputs.post0
name: Publish to medium
uses: infraway/[email protected]
with:
access_token: ${{ secrets.MEDIUM_ACCESS_TOKEN }}
markdown_file: ${{ steps.posts.outputs.post0 }}
base_url: https://double-trouble.dev
post_url: https://double-trouble.dev/blog

0 comments on commit d97e3a0

Please sign in to comment.