-
Notifications
You must be signed in to change notification settings - Fork 439
32 lines (26 loc) · 956 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
name: Release
on:
schedule:
- cron: '0 12 * * *'
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
- 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