-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (91 loc) · 2.98 KB
/
run_and_deploy.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
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Run and Deploy
on:
push:
branches:
- 'main'
pull_request:
# Allow manual runs through the web UI
workflow_dispatch:
schedule:
# ┌───────── minute (0 - 59)
# │ ┌───────── hour (0 - 23)
# │ │ ┌───────── day of the month (1 - 31)
# │ │ │ ┌───────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────── day of the week (0 - 6 or SUN-SAT)
- cron: '0 0 * * *' # Every day at 00:00 UTC
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
run_script:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install tox
- name: Run Script
run: |
tox -e py311
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: files
path: |
timeline*
deploy:
needs: [run_script]
if: |
(
github.event_name != 'pull_request' && (
github.ref_name == 'main' ||
github.event_name == 'workflow_dispatch'
)
)
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y%m%d')"
- name: Download all workflow run artifacts
uses: actions/download-artifact@v4
with:
name: files
path: ~/files
- name: Display structure of downloaded files
run: ls -R
working-directory: /home/runner/files
- name: Upload files then create tag and release
uses: ncipollo/release-action@v1
with:
name: Timeline created on ${{ steps.date.outputs.date }}
tag: ${{ steps.date.outputs.date }}
artifacts: "/home/runner/files/*"
replacesArtifacts: true
makeLatest: true
artifactErrorsFailBuild: true
allowUpdates: true
token: ${{ secrets.SDOTIMELINE }}
- name: Checkout csv to json repository
uses: actions/checkout@v4
with:
repository: 'derekeder/csv-to-html-table'
ref: 'master'
path: 'csv_to_html'
- name: Move files to csv_to_html
run: |
mv /home/runner/files/timeline_${{ steps.date.outputs.date }}.csv /home/runner/work/SDO-Timeline/SDO-Timeline/csv_to_html/data/timeline.csv
mv /home/runner/work/SDO-Timeline/SDO-Timeline/index.html /home/runner/work/SDO-Timeline/SDO-Timeline/csv_to_html/
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.SDOTIMELINE }}
publish_dir: "/home/runner/work/SDO-Timeline/SDO-Timeline/csv_to_html/"
force_orphan: true