Skip to content

Release

Release #1638

Workflow file for this run

name: Release
on:
schedule:
- cron: '0 12 * * *'
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.7
- name: Use Node.js 18
uses: actions/setup-node@v4.0.3
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