Skip to content

Update Index Release Date #26

Update Index Release Date

Update Index Release Date #26

name: Update Index Release Date
on:
workflow_dispatch:
inputs:
spreadheet_release:
type: boolean
description: Update release dates for indexed items for today's release (sets today's date for items that were prereleased, but need to be shown in NECTO today)
default: true
display_names:
type: string
description: Display Names for the product you want to index with a new date (only if previous option is not selected)
default: "MPLab Starter Kit For PIC24H MCUs,PIC24H Capacitive Touch Evaluation Board,STM32U073CB_HB MCU Support package for GCC & Clang"
index_date:
type: string
description: Which Date should it be indexed to? (only if first option is not selected)
default: "2023-12-31"
schedule:
- cron: "0 6 23 5 *" # 8:00 AM, 23rd of May
- cron: "0 6 26-27 5 *" # 8:00 AM, 26th-27th of May
jobs:
update_index_date:
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 py7zr
pip install aiohttp
pip install chardet
pip install aiofiles
pip install requests
pip install elasticsearch==7.13.4
sudo apt-get install p7zip-full
- name: Update Index Dates - Scheduled
if: ${{ github.event_name == 'schedule' }}
run: |
python -u scripts/update_prereleased_index.py "NECTO DAILY UPDATE" ${{ secrets.RELEASES_SPREADSHEET }} ${{ secrets.ES_INDEX_LIVE }} ${{ secrets.ES_HOST }} ${{ secrets.ES_USER }} ${{ secrets.ES_PASSWORD }} > message.txt
- name: Update Index Dates - Manual Run
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
python -u scripts/update_prereleased_index.py "NECTO DAILY UPDATE" ${{ secrets.RELEASES_SPREADSHEET }} ${{ secrets.ES_INDEX_LIVE }} "--spreadsheet_update" "${{ github.event.inputs.spreadheet_release }}" "--display_names" "${{ github.event.inputs.display_names }}" "--date" "${{ github.event.inputs.index_date }}" ${{ secrets.ES_HOST }} ${{ secrets.ES_USER }} ${{ secrets.ES_PASSWORD }} > message.txt
- name: Send notification to Mattermost - SDK Team
env:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL_SDK }}
run: |
MESSAGE=$(cat message.txt)
curl -X POST -H 'Content-Type: application/json' \
--data "{\"text\": \"$MESSAGE\"}" \
$MATTERMOST_WEBHOOK_URL