75 lines
2.1 KiB
YAML
75 lines
2.1 KiB
YAML
name: Build Alpine Node.js
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
NodeVersion:
|
|
required: true
|
|
description: 'Node.js version to build (ex: v12.4.0)'
|
|
PythonVersion:
|
|
required: true
|
|
description: 'Node.js v12 needs python2 and Node.js v16 needs python3'
|
|
|
|
jobs:
|
|
build:
|
|
name: Build node.js ${{github.event.inputs.NodeVersion}}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Build the Docker image
|
|
run: |
|
|
docker build --file Dockerfile --tag alpine_nodejs:${{github.event.inputs.NodeVersion}} --build-arg NodeVersion=${{github.event.inputs.NodeVersion}} --build-arg PythonVersion=${{github.event.inputs.PythonVersion}} .
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Debugging with tmate
|
|
uses: mxschmitt/action-tmate@v3
|
|
- 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}}
|
|
- name: Upload alpine node.js
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: alpine_nodejs_${{github.event.inputs.NodeVersion}}
|
|
path: ${{runner.temp}}/alpine_node/node-${{github.event.inputs.NodeVersion}}-alpine-x64.tar.gz
|
|
|
|
test:
|
|
name: Test node.js ${{github.event.inputs.NodeVersion}}
|
|
needs: [build]
|
|
runs-on: ubuntu-latest
|
|
concurrency: alpine
|
|
steps:
|
|
- name: Download alpine node.js
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: alpine_nodejs_${{github.event.inputs.NodeVersion}}
|
|
- run: |
|
|
ls -l
|
|
tar xzf ./node-${{github.event.inputs.NodeVersion}}-alpine-x64.tar.gz
|
|
./bin/node -v
|
|
./bin/node -e "console.log('hello world')"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|