-
-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (78 loc) · 2.81 KB
/
run.yml
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
76
77
78
79
80
81
82
name: Run Project
on:
push:
branches:
- main
tags:
- '*'
workflow_dispatch:
inputs:
script_name:
description: 'poetry script name'
required: true
default: ''
env:
POETRY_SCRIPT_NAME_LIST: 'hello,merge_pdf_demo,add_pdf_annotation_demo,multi_layer_pdf_demo'
jobs:
run-project:
name: Run project on ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
if: github.event_name == 'push' || github.event.inputs.script_name != ''
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
poetry-version: ['1.3.2']
os: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: abatilo/[email protected]
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: |
poetry install --sync --all-extras
- name: Run poetry script
run: |
if [ -z "${{ github.event.inputs.script_name }}" ]; then
echo "No script name provided, running all scripts"
for script_name in $(echo "${{ env.POETRY_SCRIPT_NAME_LIST }}" | tr "," " ")
do
echo "Running poetry script $script_name"
poetry run $script_name
done
else
echo "Running poetry script ${{ github.event.inputs.script_name }}"
poetry run ${{ github.event.inputs.script_name }}
fi
push-run-message:
name: Push run message
runs-on: ubuntu-latest
needs: [run-project]
steps:
- name: Push run message
uses: funnyzak/pushoo-action@main
with:
platforms: ifttt,wecombot,bark
tokens: ${{ secrets.PUSH_TOKEN }}
content: |
# ${{ github.event.repository.name }} Run Project Message
## input script name: ${{ github.event.inputs.script_name }}
## POETRY_SCRIPT_NAME_LIST: ${{ env.POETRY_SCRIPT_NAME_LIST }}
## trigger: ${{ github.event_name }} at ${{ github.event.head_commit.timestamp }}
## commit message: ${{ github.event.head_commit.message }}
## commit url: ${{ github.event.head_commit.url }}
## commit author: ${{ github.event.head_commit.author.name }}
## commit email: ${{ github.event.head_commit.author.email }}
## commit id: ${{ github.event.head_commit.id }}
title: |
${{ github.repository }} ${{ github.event_name }} Message
options: '{"bark": { "url": "https://github.com/${{github.repository}}" }}'
debug: false