nodejs-lts #526
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: nodejs-lts | |
on: | |
schedule: | |
- cron: "47 3 * * *" | |
push: | |
branches: | |
- main | |
paths: | |
- .github/workflows/nodejs-lts.yml | |
workflow_dispatch: | |
concurrency: | |
group: nodejs-lts | |
jobs: | |
fetch: | |
name: Fetch | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install uniget | |
uses: uniget-org/uniget-action@main | |
with: | |
prefix: helper | |
tools: gojq | |
- name: Fetch | |
id: fetch | |
run: | | |
MAJOR_VERSION="$( | |
curl --silent --location --fail https://github.com/nodejs/Release/raw/main/schedule.json \ | |
| jq -r 'to_entries[] | select(.value.maintenance > (now | todate)) | select(.value.lts != null) | select(.value.lts < (now | todate)) | .key' | |
)" | |
if test -z "${MAJOR_VERSION}"; then | |
echo "Failed to fetch latest tag and extract major version from release schedule" | |
exit 1 | |
fi | |
echo "### Found LTS major version ${MAJOR_VERSION}" | |
VERSION="$( | |
git ls-remote https://github.com/nodejs/node "refs/tags/${MAJOR_VERSION}.*" \ | |
| grep -v '\^{}' \ | |
| cut -f2 | cut -d/ -f3 | tr -d v \ | |
| sort -Vr | head -1 | |
)" | |
if test -z "${VERSION}"; then | |
echo "Failed to fetch tag and extract version from GitHub" | |
exit 1 | |
fi | |
echo "### Found LTS version ${VERSION}" | |
echo "version=${VERSION}" >>${GITHUB_OUTPUT} | |
- name: Release | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.BOT_GITHUB_TOKEN }} | |
allowUpdates: true | |
name: "nodejs-lts v${{ steps.fetch.outputs.version }}" | |
tag: nodejs-lts/${{ steps.fetch.outputs.version }} | |
draft: false | |
prerelease: false |