Node.js daily build job #438
This file contains hidden or 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: Node.js daily build job | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: 0 0 * * * | |
| jobs: | |
| build-daily: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| name: ['node'] | |
| version: ['20', '22', '24', '25'] | |
| latest_version: ['25'] | |
| steps: | |
| - name: Check version | |
| id: check_version | |
| run: | | |
| version=$(curl -s https://nodejs.org/download/release/index.json | jq -r '.[] | .version' | grep -E '^v'"${{ matrix.version }}" | head -n 1) | |
| if [ -z "${version}" ]; then | |
| echo "Node.js version not found" | |
| exit 1 | |
| fi | |
| echo "version=${version}" >> $GITHUB_ENV | |
| echo "Node.js current version: ${version}" | |
| major_version=$(echo ${{ matrix.version }} | sed 's/^v//') | |
| echo "major_version=${major_version}" >> $GITHUB_ENV | |
| - name: Check release | |
| id: check_release | |
| run: | | |
| gh release view ${{ env.version }} -R ${{ github.repository }} | grep SHASUMS256.txt.asc >/dev/null 2>&1 || create=1 | |
| echo "create=${create:-0}" >> $GITHUB_ENV | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Trigger workflow | |
| if: env.create == '1' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const version = process.env.version; | |
| const major = process.env.major_version; | |
| const latestMatrix = '${{ matrix.latest_version }}'; | |
| const latest_version = (major === latestMatrix) ? 'true' : 'false'; | |
| await github.rest.actions.createWorkflowDispatch({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| workflow_id: 'custom.yml', | |
| ref: 'master', | |
| inputs: { | |
| version: version, | |
| latest_version: latest_version | |
| } | |
| }) |