Skip to content

Commit

Permalink
Test new way to publish in medium
Browse files Browse the repository at this point in the history
  • Loading branch information
luiscachog committed Apr 19, 2023
1 parent b1c4c10 commit 262c7bf
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 15 deletions.
48 changes: 34 additions & 14 deletions .github/workflows/publish-to-medium-dev-to.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ name: to-medium-dev-to
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
workflow_run:
workflows:
- algolia-search
types:
- completed
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
Expand All @@ -19,25 +19,45 @@ on:
jobs:
# This workflow contains a single job called "build"
build:
name: publish posts on medium and dev.to
name: publish posts on medium
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.PERSONAL_SUBMODULES_PULL_KEY }}
submodules: recursive
lfs: true

- name: Crosspost to medium and dev.to
uses: basicBrogrammer/crosspost-markdown@v0.1.1
- name: Get All Changed Files
id: files
uses: jitterbit/get-changed-files@v1
- name: Get Post Changed from the all changed files
id: posts
run: |
i=0
for changed_file in ${{ steps.files.outputs.added_modified }}; do
echo "Found changed file in: ${changed_file}."
if [[ "${changed_file}" == "content/post"* ]];
then
echo "File ${changed_file} matched post."
echo "::set-output name=post${i}::${changed_file}"
((i=i+1))
fi
done
- name: Publish to medium
if: steps.posts.outputs.post0
uses: philips-software/post-to-medium-action@v0.4.1
with:
dev-to-token: ${{secrets.DEV_TO_TOKEN}}
github-token: ${{secrets.GITHUB_TOKEN}}
medium-token: ${{secrets.MEDIUM_TOKEN}}
medium-author-id: ${{secrets.MEDIUM_AUTHOR_ID}}
content-dir: content/post/*/*.md
integration_token: ${{ secrets.MEDIUM_TOKEN }}
content_format: "markdown"
file: ${{ steps.posts.outputs.post0 }}
publish_status: draft
license: cc-40-by-nc-sa
notify_followers: "false"
canonical_url: https://luiscachog.io
parse_frontmatter: true
2 changes: 1 addition & 1 deletion content/post/im-a-racker/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ categories: [ DevOps, Rackspace]
keywords: [ DevOps, Rackspace, Racker]
date: 2014-03-31
publishDate: 2014-03-31
lastmod: 2021-05-02
lastmod: 2023-04-14
featured: true
draft: false

Expand Down

0 comments on commit 262c7bf

Please sign in to comment.