-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (85 loc) · 3.44 KB
/
Copy pathget-data.yaml
File metadata and controls
100 lines (85 loc) · 3.44 KB
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
96
97
98
99
100
name: Daily Data Fetch
on:
schedule:
# This will run at 00:00, 08:00, and 16:00 UTC
- cron: "0 0,8,16 * * *"
workflow_dispatch:
permissions:
contents: write
jobs:
data-fetch:
name: Collect Data from Jira
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v7
with:
token: ${{ secrets.GHTOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v4
- name: Set short SHA
run: echo "SHORT_SHA=$(echo ${GITHUB_SHA::7})" >> $GITHUB_ENV
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Get current time
run: echo "CURRENT_TIME=$(date +'%H%M%S')" >> $GITHUB_ENV
- name: Build Container Image
id: build_container
uses: docker/build-push-action@v7
with:
load: true
context: .
file: ./Dockerfile
platforms: linux/amd64
tags: riscvintl/bod-jira-data-image:latest
- name: Run Container
id: run_container
if: steps.build_container.outcome == 'success'
run: docker run --rm -e JIRA_TOKEN=${{ secrets.JIRATOKEN }} -e JIRA_EMAIL=${{ secrets.JIRA_EMAIL }} -e GHTOKEN=${{ secrets.GHTOKEN }} -v ./:/usr/src/app/ riscvintl/bod-jira-data-image:latest
- name: Upload Data
if: steps.run_container.outcome == 'success'
uses: actions/upload-artifact@v7
with:
name: spec-data.csv
path: ${{ github.workspace }}/*.csv
- name: Create Release
if: steps.run_container.outcome == 'success' && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
uses: softprops/action-gh-release@v3 #softprops/action-gh-release@v2
with:
draft: false
tag_name: bod-jira-data-${{ env.SHORT_SHA }}-${{ env.CURRENT_DATE }}-${{ env.CURRENT_TIME }}
name: ${{ env.CURRENT_TIME }}
body: |
This release was created by: ${{ github.event.sender.login }}
Release Notes: ${{ github.event.inputs.release_notes }}
files: |
${{ github.workspace }}/*.csv
env:
GITHUB_TOKEN: ${{ secrets.GHTOKEN }}
- name: Update latest CSV for UI
if: steps.run_container.outcome == 'success' && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
run: |
set -euo pipefail
latest_csv=$(ls -t specs_*.csv | head -n1 || true)
if [ -z "$latest_csv" ]; then
echo "No specs_*.csv found."
exit 1
fi
mkdir -p web-ui/public
cp "$latest_csv" web-ui/public/latest.csv
printf "updated_at=%s\nrun_id=%s\n" \
"$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
"${GITHUB_RUN_ID}" \
> web-ui/public/latest.csv.meta
- name: Commit latest CSV
if: steps.run_container.outcome == 'success' && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add web-ui/public/latest.csv web-ui/public/latest.csv.meta
git commit -m "Update latest CSV" --allow-empty
git push origin HEAD:main