Files
alpine_nodejs/.github/workflows/docker-image.yml
Tingluo Huang 03f937ba72 create release.
2021-10-24 23:10:52 -04:00

85 lines
3.0 KiB
YAML

name: Build Alpine Node.js
permissions:
contents: 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: 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@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
container: 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
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
uses: actions/download-artifact@v2
with:
name: alpine_nodejs_${{github.event.inputs.NodeVersion}}
# Create GitHub release
- uses: actions/create-release@master
id: createRelease
name: Create node.js ${{github.event.inputs.NodeVersion}} Alpine Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "${{github.event.inputs.NodeVersion}}"
release_name: "${{github.event.inputs.NodeVersion}}"
body: |
Alpine node.js ${{github.event.inputs.NodeVersion}}
# Upload release assets
- name: Upload Release Asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.createRelease.outputs.upload_url }}
asset_path: ${{ github.workspace }}/node-${{github.event.inputs.NodeVersion}}-alpine-x64.tar.gz
asset_name: node-${{github.event.inputs.NodeVersion}}-alpine-x64.tar.gz
asset_content_type: application/octet-stream