Skip to content

Commit 60183be

Browse files
committed
boysouting and add YEAR_MONTH as env var to use in commit message
1 parent 4e2ceb1 commit 60183be

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

.github/workflows/dbip_download.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
env:
99
SKIP_EXPORT: 'false'
1010
TEMP_DIR: '/tmp'
11+
YEAR_MONTH: '01-9999'
1112

1213
permissions:
1314
contents: write
@@ -28,20 +29,18 @@ jobs:
2829
run: |
2930
cd ip_country
3031
export YEAR_MONTH=$(date +%Y-%m)
32+
echo "TEMP_DIR=$(mktemp -d)" >> $GITHUB_ENV
33+
echo "YEAR_MONTH=$YEAR_MONTH" >> $GITHUB_ENV
3134
mkdir -p dbip-data
3235
curl -L -o dbip-data/dbip-country-lite.mmdb.gz "https://download.db-ip.com/free/dbip-country-lite-$YEAR_MONTH.mmdb.gz"
3336
gunzip dbip-data/dbip-country-lite.mmdb.gz
34-
echo "TEMP_DIR=$(mktemp -d)" >> $GITHUB_ENV
3537
if [ "$?" -ne "0" ]; then
3638
echo "SKIP_EXPORT=true" >> $GITHUB_ENV
3739
fi
3840
3941
- name: Generate Rust source file
4042
if: ${{ env.SKIP_EXPORT == 'false' }}
4143
run: |
42-
set -xv
43-
echo $TEMP_DIR
44-
pwd
4544
cd ip_country
4645
mkdir -p generated
4746
cargo run < "dbip-data/dbip-country-lite.mmdb" > "$TEMP_DIR"/dbip_country.rs
@@ -53,15 +52,12 @@ jobs:
5352
- name: Commit and push generated file
5453
if: ${{ env.SKIP_EXPORT == 'false' }}
5554
run: |
56-
set -xv
5755
git config user.name "github-actions[bot]"
5856
git config user.email "github-actions[bot]@users.noreply.github.com"
5957
git checkout -B generated-source
6058
git rm -rf .
61-
ls -la
62-
ls -la ip_country
6359
mkdir ip_country/src
6460
mv "${TEMP_DIR}"/dbip_country.rs ip_country/src/dbip_country.rs
6561
git add ip_country/src/dbip_country.rs
66-
git commit -m "Update generated dbip_country Rust source file"
62+
git commit -m "Update generated dbip_country ${YEAR_MONTH} Rust source file"
6763
git push origin generated-source --force

0 commit comments

Comments
 (0)