-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
63 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: 6 scheduled production worker | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 1,12 * * *' | ||
- cron: '0 4 1 * *' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
env: | ||
DJANGO_DEBUG: 0 | ||
STRIPE_SECRET_KEY: ${{ secrets.STRIPE_SECRET_KEY }} | ||
NEON_API_KEY: ${{ secrets.NEON_API_KEY }} | ||
NEON_PROD_BRANCH: "main" | ||
NEON_PROJECT_ID: ${{ secrets.NEON_PROJECT_ID }} | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
- name: Setup NodeJs | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.11' | ||
- name: Install Neon CLI | ||
run: | | ||
npm install -g neonctl | ||
- name: Database URL Env Val for new Github Actions branch | ||
run: | | ||
MY_NEON_CONN_STRING=$(neonctl connection-string --branch "${{ env.NEON_PROD_BRANCH }}" --project-id "${{ env.NEON_PROJECT_ID }}") | ||
echo "DATABASE_URL=$MY_NEON_CONN_STRING" >> $GITHUB_ENV | ||
- name: Setup Django Secret key | ||
run: | | ||
MY_GEN_KEY=$(openssl rand -base64 32) | ||
echo "DJANGO_SECRET_KEY=$MY_GEN_KEY" >> $GITHUB_ENV | ||
- name: Install Requirements | ||
run: | | ||
python -m pip install pip --upgrade | ||
python -m pip install -r requirements.txt | ||
- name: Django Users sync stripe subscriptions | ||
working-directory: ./src | ||
if: github.event.schedule != '0 4 1 * *' | ||
run: | | ||
python manage.py sync_user_subs --day-start 0 --day-end 1 | ||
- name: Django Users clear dangling stripe subscriptions | ||
working-directory: ./src | ||
if: github.event.schedule == '0 4 1 * *' | ||
run: | | ||
python manage.py sync_user_subs --clear-dangling |
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
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