Update merge.yml #33
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
name: Publish content before merging | |
on: | |
push: | |
# to be changed to 'main' | |
branches: ['publish-article-pipeline'] | |
jobs: | |
check-unpublished: | |
runs-on: ubuntu-latest | |
outputs: | |
should_publish: ${{ steps.should-publish.outputs.should_publish }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Should publish | |
id: should-publish | |
run: echo "should_publish=$([[ -d "content/posts/unpublished" ]] && echo true || echo false)" >> "$GITHUB_OUTPUT" | |
publish: | |
runs-on: ubuntu-latest | |
needs: check-unpublished | |
if: ${{ needs.check-unpublished.outputs.should_publish }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.BOSS_TOKEN }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Move article to current date directory | |
run: | | |
npm ci | |
npm run build:utils | |
npm run posts:publish | |
- name: Commit changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "backbaseoss" | |
git add content | |
git commit -m "[BOT] Post published" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.BOSS_TOKEN }} | |
branch: ${{ github.ref }} |