Skip to content

Create content file #893

Create content file

Create content file #893

name: Create content file
on:
schedule:
- cron: '20 14 * * 1-5'
workflow_dispatch:
env:
DEBUG: 1
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
GOOGLE_REFRESH_TOKEN: ${{ secrets.GOOGLE_REFRESH_TOKEN }}
# ACTIONS_RUNNER_DEBUG: true
# ACTIONS_STEP_DEBUG: true
jobs:
CreateContentFile:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.JS environment
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8
- name: Global output
id: global
run: |
echo "formattedDate=$(date +%d/%m/%Y)"
echo "bashDate=$(date +%d-%m-%Y)"
- name: podcast-maker CLI cache
uses: actions/cache@v3
id: podcast-maker-cache
with:
path: |
**/node_modules
dist
bin
key: cli-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/pnpm.lock') }}
- name: Build
if: steps.podcast-maker-cache.outputs.cache-hit != 'true'
run: |
pnpm i
pnpm build
- name: Create SymLink from content directory (on code) to content directory (created by podcast-maker CLI)
run: |
ContentPath=$(./bin/run info content --dir)
if [ -d "$ContentPath" ]; then
ls $ContentPath;
echo "ContentPath exists, deleting it";
rm -rf $ContentPath;
fi;
echo "Creating SymLink from $(pwd)/content to $ContentPath";
ln -s $(pwd)/content $ContentPath
- name: Get current date
id: date
run: |
echo "formattedDate=$(date +%d/%m/%Y)" >> $GITHUB_OUTPUT
echo "bashDate=$(date +%d-%m-%Y)" >> $GITHUB_OUTPUT
- name: Create Content File
run: ./bin/run content mail
- name: Generate GitHub Token
uses: tibdex/github-app-token@v1.5.0
id: generate-token
with:
app_id: ${{ secrets.ID_GITHUB_APP }}
private_key: ${{ secrets.PRIVATE_KEY_GITHUB_APP }}
- name: Create PR to master with Content File
uses: peter-evans/create-pull-request@v4
with:
title: Conteúdo ${{ steps.date.outputs.formattedDate }}
body: Automação - Conteúdo ${{ steps.date.outputs.formattedDate }}
branch: ${{ steps.date.outputs.formattedDate }}
commit-message: Conteúdo ${{ steps.date.outputs.formattedDate }}
token: ${{ steps.generate-token.outputs.token }}
# - name: SSH debug
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true