publish a new blog: IVF (#480) #403
This file contains hidden or 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
| name: Trigger medium publish if new post | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| description: 'Branch to run the workflow' | |
| required: false | |
| default: 'master' | |
| push: | |
| paths: | |
| - "blog/**" | |
| branches: | |
| - master | |
| jobs: | |
| build: | |
| runs-on: "ubuntu-latest" | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: actions/setup-node@v2 | |
| with: | |
| node-version: "18" | |
| - uses: jitterbit/get-changed-files@v1 | |
| id: added_files | |
| with: | |
| format: space-delimited | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Printing | |
| run: | | |
| echo "All:" | |
| echo "${{ steps.added_files.outputs.all }}" | |
| echo "Added:" | |
| echo "${{ steps.added_files.outputs.added }}" | |
| echo "Removed:" | |
| echo "${{ steps.added_files.outputs.removed }}" | |
| echo "Renamed:" | |
| echo "${{ steps.added_files.outputs.renamed }}" | |
| echo "Modified:" | |
| echo "${{ steps.added_files.outputs.modified }}" | |
| echo "Added+Modified:" | |
| echo "${{ steps.added_files.outputs.added_modified }}" | |
| - name: Post new blog to medium | |
| if: ${{ steps.added_files.outputs.added }} | |
| env: | |
| MEDIUM_ID: ${{secrets.MEDIUM_ID}} | |
| MEDIUM_PUBLICATION_ID: ${{secrets.MEDIUM_PUBLICATION_ID}} | |
| MEDIUM_TOKEN: ${{secrets.MEDIUM_TOKEN}} | |
| FILES: ${{ steps.added_files.outputs.added }} | |
| REPOST_SUCCESS_FEISHU_ALERT_URL_TOKEN: ${{secrets.REPOST_SUCCESS_FEISHU_ALERT_URL_TOKEN}} | |
| REPOST_FAILURE_FEISHU_ALERT_URL_TOKEN: ${{secrets.REPOST_FAILURE_FEISHU_ALERT_URL_TOKEN}} | |
| run: | | |
| mv postMedium.md postMedium.js | |
| yarn | |
| node postMedium.js $FILES |