Skip to content

Commit

Permalink
check and build with scheduled tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
sbwml committed Jun 28, 2023
1 parent 190aa16 commit 3c40a5d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 25 deletions.
51 changes: 34 additions & 17 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
name: Build releases

on:
watch:
types: started
schedule:
- cron: 0 23 * * *

jobs:
build:
if: github.event.repository.owner.id == github.event.sender.id
name: Build ${{ matrix.tag }} Version
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container: ["centos:7"]
tag:
- lts
- current

container:
image: ${{ matrix.container }}
image: centos:7

steps:
- name: Checkout
Expand All @@ -28,46 +25,66 @@ jobs:
run: |
yum makecache
yum install -y centos-release-scl-rh centos-release-scl
yum install -y devtoolset-10-gcc devtoolset-10-gcc-c++ devtoolset-10-make wget make python3
yum install -y devtoolset-10-gcc devtoolset-10-gcc-c++ devtoolset-10-make wget make python3 curl
- name: Set node version
- name: Check Node Version
run: |
source ./node_version
# the original commit does not seem to be readable inside the container, so use github api.
TAGS=$(curl -sk https://api.github.com/repos/sbwml/node-latest-centos/tags | grep "name")
if [[ ${{ matrix.tag }} == "lts" ]]; then
echo "DIST=$LTS_DIST" >> "$GITHUB_ENV"
echo "VERSION=$LTS_VERSION" >> "$GITHUB_ENV"
LATEST_VERSION=$(curl -sk https://nodejs.org/en | sed -n 's/.*title="Download \(.*\) LTS".*/\1/p')
echo "PRE_RELEASE=false" >> "$GITHUB_ENV"
else
LATEST_VERSION=$(curl -sk https://nodejs.org/en | sed -n 's/.*title="Download \(.*\) Current".*/\1/p')
echo "PRE_RELEASE=true" >> "$GITHUB_ENV"
fi
if [[ "$TAGS" == *"$LATEST_VERSION"* ]]; then
echo -e " \n\e[1;32mnode-v$LATEST_VERSION is already the latest version.\e[0m\n"
exit 0
else
echo "DIST=$CURRENT_DIST" >> "$GITHUB_ENV"
echo "VERSION=$CURRENT_VERSION" >> "$GITHUB_ENV"
echo "VERSION=$LATEST_VERSION" >> "$GITHUB_ENV"
echo "next=true" >> "$GITHUB_ENV"
fi
- name: Download node source code
- name: Download Node source code
if: env.next == 'true'
run: |
wget https://nodejs.org/dist/latest-v${{ env.DIST }}/node-v${{ env.VERSION }}.tar.xz
wget https://nodejs.org/dist/v${{ env.VERSION }}/node-v${{ env.VERSION }}.tar.xz
tar -Jxf node-v${{ env.VERSION }}.tar.xz
- name: Build node
- name: Build Node
if: env.next == 'true'
run: |
source /opt/rh/devtoolset-10/enable
cd node-v${{ env.VERSION }}
./configure --prefix=../node-v${{ env.VERSION }}-linux-x$(getconf LONG_BIT)
make -j$(($(nproc --all)+1)) && make install && cp -a ./{LICENSE,CHANGELOG.md,README.md} ../node-v${{ env.VERSION }}-linux-x$(getconf LONG_BIT)/
strip ../node-v${{ env.VERSION }}-linux-x$(getconf LONG_BIT)/bin/node
- name: Create archive
- name: Create Archive
if: env.next == 'true'
run: |
mkdir tar
tar Jcvf tar/node-v${{ env.VERSION }}-linux-x$(getconf LONG_BIT).tar.xz node-v${{ env.VERSION }}-linux-x$(getconf LONG_BIT)
tar zcvf tar/node-v${{ env.VERSION }}-linux-x$(getconf LONG_BIT).tar.gz node-v${{ env.VERSION }}-linux-x$(getconf LONG_BIT)
cd tar && sha256sum node-v* > sha256sum.txt
- name: Upload Artifacts
if: env.next == 'true'
uses: actions/upload-artifact@v3
with:
name: node-v${{ env.VERSION }}
path: tar/*

- name: Create release
if: env.next == 'true'
uses: ncipollo/release-action@v1
with:
name: node-v${{ env.VERSION }}
allowUpdates: true
tag: v${{ env.VERSION }}
commit: master
replacesArtifacts: true
prerelease: ${{ env.PRE_RELEASE }}
token: ${{ secrets.workflow_token }}
artifacts: tar/*
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Node.js - CentOS 7

Due to the low version of centos/redhat 7 glibc, the latest version of [Node.js](https://nodejs.org/) cannot be used. So recompile it with centos container here.
<div align="center">
<img src="https://github.com/sbwml/node-latest-centos/assets/16485166/70b033f9-0f63-4738-ae9a-9ebc2a257636" height="120.0px"/>
<h3 align="center">Node.js - Rebuilt for CentOS 7</h3>
<h3 align="center">Due to the outdated version of glibc in the CentOS/Red Hat 7 distribution, which does not meet the requirements for running the latest version of <a href="https://nodejs.org/">Node.js</a>, it is necessary to rebuild it using a centos container.</h3>
</div>
5 changes: 0 additions & 5 deletions node_version

This file was deleted.

0 comments on commit 3c40a5d

Please sign in to comment.