|
| 1 | +name: Plotly Artifacts |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Run once daily at 00:00 UTC |
| 6 | + - cron: '0 0 * * *' |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + publish-artifact: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Download latest Plotly.js |
| 14 | + id: download |
| 15 | + run: | |
| 16 | + # Get latest release tag |
| 17 | + RESPONSE=$(curl -s https://api.github.com/repos/plotly/plotly.js/releases/latest) |
| 18 | + VERSION=$(echo $RESPONSE | jq -r '.tag_name') |
| 19 | + DOWNLOAD_URL="https://github.com/plotly/plotly.js/raw/$VERSION/dist/plotly.min.js" |
| 20 | +
|
| 21 | + # Download the file |
| 22 | + curl -L -o plotly.min.js "$DOWNLOAD_URL" |
| 23 | +
|
| 24 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 25 | + echo "Downloaded Plotly version: $VERSION" |
| 26 | + - name: Download latest Plotly schema |
| 27 | + run: | |
| 28 | + VERSION="${{ steps.download.outputs.version }}" |
| 29 | + SCHEMA_URL="https://github.com/plotly/plotly.js/raw/$VERSION/dist/plot-schema.json" |
| 30 | +
|
| 31 | + curl -L -o plot-schema.json "$SCHEMA_URL" |
| 32 | + echo "Downloaded Plotly schema for version: $VERSION" |
| 33 | + - name: Download Plotly Python templates |
| 34 | + run: | |
| 35 | + mkdir -p templates |
| 36 | +
|
| 37 | + TEMPLATES=("ggplot2" "gridon" "plotly" "plotly_dark" "plotly_white" "presentation" "seaborn" "simple_white" "xgridoff" "ygridoff") |
| 38 | +
|
| 39 | + for template in "${TEMPLATES[@]}"; do |
| 40 | + TEMPLATE_URL="https://raw.githubusercontent.com/plotly/plotly.py/refs/heads/main/plotly/package_data/templates/${template}.json" |
| 41 | + curl -L -o "templates/${template}.json" "$TEMPLATE_URL" |
| 42 | + echo "Downloaded template: $template" |
| 43 | + done |
| 44 | +
|
| 45 | + echo "Downloaded all Plotly Python templates" |
| 46 | + - name: Create tar.gz artifact |
| 47 | + run: | |
| 48 | + mkdir -p plotlylightartifacts |
| 49 | + cp plotly.min.js plotlylightartifacts/ |
| 50 | + cp plot-schema.json plotlylightartifacts/ |
| 51 | + cp -r templates plotlylightartifacts/ |
| 52 | +
|
| 53 | + tar -czf plotlylightartifacts.tar.gz plotlylightartifacts/ |
| 54 | + echo "Created plotlylightartifacts.tar.gz" |
| 55 | + - name: Upload artifact |
| 56 | + uses: actions/upload-artifact@v4 |
| 57 | + with: |
| 58 | + name: plotlylightartifacts |
| 59 | + path: plotlylightartifacts.tar.gz |
| 60 | + retention-days: 90 |
0 commit comments