-
Notifications
You must be signed in to change notification settings - Fork 438
33 lines (27 loc) · 985 Bytes
/
release.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
name: Release
on:
schedule:
- cron: '0 12 * * *'
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Use Node.js 18
uses: actions/[email protected]
with:
node-version: 18
cache: 'npm'
- name: Tag latest release
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
read next latest <<< $(npm info tedious --json | jq -r '."dist-tags".next, ."dist-tags".latest')
if [ "$(printf '%s\n' "$latest" "$next" | sort -V | tail -n 1)" != "$latest" ]; then
date_format="%Y-%m-%dT%H:%M:%SZ"
publish_date=$(date -d $(npm info tedious --json | jq -r '.time["'"$next"'"]') +$date_format)
week_ago=$(date -d '-7 days' +$date_format)
if [[ "$publish_date" < "$week_ago" || "$publish_date" == "$week_ago" ]]; then
npm dist-tag add "tedious@$next" latest
fi
fi