name: Build Alpine Node.js permissions: contents: write on: 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}} runs-on: ubuntu-latest 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 . - 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@v3 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@v3 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@v3 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