TMP run on push #1
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: Build Alpine Node.js | |
permissions: | |
contents: write | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
NodeVersion: | |
required: true | |
description: 'Node.js version to build (ex: v12.22.7, v16.12.0)' | |
jobs: | |
build: | |
name: Build node.js ${{github.event.inputs.NodeVersion}} (${{matrix.arch}}) | |
runs-on: ${{matrix.runner}} | |
strategy: | |
matrix: | |
include: | |
- arch: x64 | |
runner: ubuntu-latest | |
- arch: arm64 | |
runner: ubuntu-24.04-arm | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build the Docker image | |
run: | | |
NodeVersion="${{github.event.inputs.NodeVersion}}" | |
PythonVersion="python3" | |
if [[ $NodeVersion = v12* ]] | |
then | |
PythonVersion="python2" | |
fi | |
echo node.js version $NodeVersion | |
echo python version $PythonVersion | |
docker build --file Dockerfile --tag alpine_nodejs:${{github.event.inputs.NodeVersion}} \ | |
--build-arg NodeVersion=${{github.event.inputs.NodeVersion}} \ | |
--build-arg PythonVersion=$PythonVersion \ | |
--build-arg NodeArch=${{matrix.arch}} \ | |
. | |
- name: Copy alpine node.js out | |
run: | | |
mkdir $RUNNER_TEMP/alpine_node | |
docker run --rm -v $RUNNER_TEMP/alpine_node:/node_output alpine_nodejs:${{github.event.inputs.NodeVersion}} | |
ls -l -R $RUNNER_TEMP/alpine_node | |
- name: Upload alpine node.js | |
uses: actions/upload-artifact@v4 | |
with: | |
name: alpine_nodejs_${{github.event.inputs.NodeVersion}}_${{matrix.arch}} | |
path: ${{runner.temp}}/alpine_node/node-${{github.event.inputs.NodeVersion}}-alpine-${{matrix.arch}}.tar.gz | |
test: | |
name: Test node.js ${{github.event.inputs.NodeVersion}} | |
needs: [build] | |
runs-on: ${{matrix.runner}} | |
strategy: | |
matrix: | |
include: | |
- arch: x64 | |
runner: ubuntu-latest | |
- arch: arm64 | |
runner: ubuntu-24.04-arm | |
container: alpine | |
steps: | |
- name: Download alpine node.js | |
uses: actions/download-artifact@v4 | |
with: | |
name: alpine_nodejs_${{github.event.inputs.NodeVersion}}_${{matrix.arch}} | |
- run: | | |
ls -l | |
tar xzf ./node-${{github.event.inputs.NodeVersion}}-alpine-${{matrix.arch}}.tar.gz | |
ls -l -R | |
./bin/node -v | |
./bin/node -e "console.log('hello world')" | |
uname -a | |
ldd ./bin/node | |
name: Test node | |
release: | |
name: Create release for node.js ${{github.event.inputs.NodeVersion}} | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download alpine node.js (x64 and arm64) | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: alpine_nodejs_${{github.event.inputs.NodeVersion}}_* | |
merge-multiple: true | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: "${{github.event.inputs.NodeVersion}}" | |
name: "${{github.event.inputs.NodeVersion}}" | |
body: | | |
Alpine node.js ${{github.event.inputs.NodeVersion}} | |
files: | | |
node-*-alpine-*.tar.gz |