-
Notifications
You must be signed in to change notification settings - Fork 39
75 lines (67 loc) · 2.74 KB
/
updateReleaseCalendar.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Update Release Calendar
on:
# Trigger the workflow every Monday at 07:00 Belgrade time (adjusted for UTC)
schedule:
- cron: '0 6 * * 1'
workflow_dispatch:
# Can also be triggered manually if needed
inputs:
calendar_name:
type: string
description: Calendar Name
default: "Product - Update"
force_update:
type: boolean
description: "If checked, will update an existing event with new data. Otherwise, skips it."
default: false
jobs:
update-calendar:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Cache Python packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install pytz
pip install requests
pip install py7zr
pip install chardet
- name: Determine Calendar Name
id: determine_calendar
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "CALENDAR_NAME=${{ github.event.inputs.calendar_name }}" >> $GITHUB_OUTPUT
else
echo "CALENDAR_NAME=Product - Update" >> $GITHUB_OUTPUT
fi
- name: Set Force Update Flag
id: set_force_update # Will be set to false for every CRON trigger
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ github.event.inputs.force_update }}" == "true" ]]; then
echo "FORCE_UPDATE_FLAG=--force_update" >> $GITHUB_OUTPUT
else
echo "FORCE_UPDATE_FLAG=" >> $GITHUB_OUTPUT
fi
- name: Update Release Calendar
env:
TEAM_UP_API_KEY: ${{ secrets.TEAM_UP_API_KEY }}
TEAM_UP_CALENDAR_LINK: ${{ secrets.TEAM_UP_CALENDAR_LINK }}
RELEASES_SPREADSHEET: ${{ secrets.RELEASES_SPREADSHEET }}
run: |
if [[ "${{ steps.set_force_update.outputs.FORCE_UPDATE_FLAG }}" == "--force_update" ]]; then
python -u scripts/release_calendar.py "$TEAM_UP_API_KEY" "NECTO DAILY UPDATE" "${{ steps.determine_calendar.outputs.CALENDAR_NAME }}" "$TEAM_UP_CALENDAR_LINK" "$RELEASES_SPREADSHEET" "${{ steps.set_force_update.outputs.FORCE_UPDATE_FLAG }}"
else
python -u scripts/release_calendar.py "$TEAM_UP_API_KEY" "NECTO DAILY UPDATE" "${{ steps.determine_calendar.outputs.CALENDAR_NAME }}" "$TEAM_UP_CALENDAR_LINK" "$RELEASES_SPREADSHEET"
fi