Skip to content

Commit 27ff728

Browse files
committed
try with updated github actions syntax
1 parent d6d151f commit 27ff728

File tree

1 file changed

+32
-14
lines changed

1 file changed

+32
-14
lines changed

.github/workflows/pipeline.yaml

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,43 @@ jobs:
2020
- name: Build docker image
2121
run: docker build -t gradient-pipeline ./pipeline
2222

23-
- name: Run the pipeline
23+
- name: set date
24+
id: set_date
2425
run: |
2526
current_date=$(date +%Y-%m-%d)
27+
echo "CURRENT_DATE=$current_date" >> $GITHUB_OUTPUT
28+
29+
- name: set hour minus two
30+
id: set_hour
31+
run: |
2632
current_hour=$(date +%H)
2733
hour_minus_two=$((current_hour - 2))
28-
if [ $hour_minus_two -lt 0 ]; then
29-
current_date=$(date -d "-1 day" +%Y-%m-%d)
30-
hour_minus_two=$((current_hour + 22))
31-
fi
32-
docker run -it -v ./data:/tmp gradient-pipeline sh -c "node cli.js process-hour $current_date $hour_minus_two"
33-
if [ $? -eq 0 ]; then
34-
# Add a leading zero if the hour is less than 10
35-
[[ $hour_minus_two -lt 10 && $hour_minus_two -ge 0 ]] && hour_minus_two="0$hour_minus_two"
36-
file_name="${current_date}T${hour_minus_two}"
37-
docker run -it -v ./data:/tmp gradient-pipeline sh -c "ogr2ogr -f FlatGeobuf /tmp/${file_name}.fgb /tmp/${file_name}.geojson -skipfailures"
38-
else
39-
echo "Previous command failed"
40-
exit 1
34+
echo "CURRENT_HOUR=$current_hour" >> $GITHUB_OUTPUT
35+
echo "HOUR_MINUS_TWO=$hour_minus_two" >> $GITHUB_OUTPUT
36+
37+
- name: process changesets
38+
run: |
39+
docker run -v ./data:/tmp gradient-pipeline sh -c "node cli.js process-hour $CURRENT_DATE $HOUR_MINUS_TWO"
40+
env:
41+
CURRENT_DATE: ${{ steps.set_date.outputs.CURRENT_DATE }}
42+
HOUR_MINUS_TWO: ${{ steps.set_hour.outputs.HOUR_MINUS_TWO }}
43+
44+
- name: padded hour
45+
id: padded_hour
46+
run: |
47+
if [[ $HOUR_MINUS_TWO -lt 10 && $HOUR_MINUS_TWO -gt 0 ]]; then
48+
HOUR_MINUS_TWO="0$HOUR_MINUS_TWO"
4149
fi
50+
echo "PADDED_HOUR=$HOUR_MINUS_TWO" >> $GITHUB_OUTPUT
51+
env:
52+
HOUR_MINUS_TWO: ${{ steps.set_hour.outputs.HOUR_MINUS_TWO }}
53+
54+
- name: convert to fgb
55+
run: |
56+
docker run -v ./data:/tmp gradient-pipeline sh -c "ogr2ogr -f FlatGeobuf /tmp/${CURRENT_DATE}T${PADDED_HOUR}.fgb /tmp/${CURRENT_DATE}T${PADDED_HOUR}.geojson -skipfailures"
57+
env:
58+
CURRENT_DATE: ${{ steps.set_date.outputs.CURRENT_DATE }}
59+
PADDED_HOUR: ${{ steps.padded_hour.outputs.PADDED_HOUR }}
4260

4361
- name: Check if the pipeline ran successfully
4462
run: ls -lh ./data

0 commit comments

Comments
 (0)