Compare commits

..

19 Commits

Author SHA1 Message Date
Tingluo Huang
009ca1c607 Merge pull request #10 from TingluoHuang/main
Create schedule workflow to build/publish node.js on schedules.
2025-05-16 08:34:44 -04:00
Tingluo Huang
5a1827ae4c Add new schedule workflow to keep building node.js 2025-05-16 02:53:30 +00:00
Tingluo Huang
3b5ac71c72 Merge pull request #6 from actions/pje/upgrade-upload-artifact-to-v4
Upgrade actions/upload-artifact to v4
2024-10-10 16:08:49 -04:00
Patrick Ellis
42c4c32b8f Merge pull request #4 from alex/patch-1
Correct SUPPORT documentation
2024-05-13 16:57:25 -04:00
Patrick Ellis
f1f4280c19 Upgrade actions/upload-artifact to v4
Versions at or below v3 are deprecated and will be unusable in November.

https://github.blog/changelog/2024-04-16-deprecation-notice-v3-of-the-artifact-actions/
2024-05-13 16:49:38 -04:00
Josh Gross
1598397a66 Merge pull request #5 from actions/joshmgross/delete-ownership
Delete ownership.yaml
2024-03-19 12:48:05 -04:00
Josh Gross
024e36f5e0 Delete ownership.yaml 2024-03-06 14:45:02 -05:00
Alex Gaynor
eb84d7646a Correct SUPPORT documentation
This repo supports neither issues nor documentation
2024-01-11 09:39:24 -05:00
Ben Wells
d585b049e5 Merge pull request #3 from actions/benwells/update-ownership-yml
Update ownership.yaml
2023-12-12 10:19:17 -05:00
Ben Wells
18679c6c19 Update ownership.yaml 2023-12-12 10:16:11 -05:00
Tingluo Huang
66db024c59 Merge pull request #2 from actions/benwells/update-ownership-slack
Update slack channel associated with ownership.yaml
2023-10-18 13:37:16 -04:00
Ben Wells
8421ebc16f Update ownership.yaml 2023-10-18 13:24:57 -04:00
Thomas Boop
9a0377c9f9 Merge pull request #1 from jcmanzo/patch-1
Update ownership.yaml
2023-10-11 13:22:26 -04:00
JC
6bb24f4f08 Update ownership.yaml
Updates service naming for actions-alpine-nodejs.

For more context, see https://thehub.github.com/epd/engineering/products-and-services/internal/service-catalog/multi-host-org-support/#name-uniqueness
2023-10-11 10:34:28 -04:00
Ryan van Zeben
6054417c26 Update ownership.yaml 2023-09-15 13:34:15 -04:00
Ryan van Zeben
7260fb7f61 Create ownership.yaml 2023-09-15 13:33:15 -04:00
Ryan van Zeben
0bc3793a68 Create SUPPORT.md 2023-09-15 13:18:30 -04:00
Ryan van Zeben
ab1bc511a8 Update README.md 2023-09-15 13:15:59 -04:00
Ryan van Zeben
0ac3a85234 Add in contributing file 2023-09-15 13:07:14 -04:00
6 changed files with 174 additions and 32 deletions

View File

@@ -8,16 +8,47 @@ on:
NodeVersion:
required: true
description: 'Node.js version to build (ex: v12.22.7, v16.12.0)'
workflow_call:
inputs:
NodeVersion:
required: true
description: 'Node.js version to build (ex: v12.22.7, v16.12.0)'
type: string
jobs:
prebuild:
outputs:
NodeVersion: ${{ steps.check_node_version.outputs.NodeVersion }}
name: Determine node.js version
runs-on: ubuntu-latest
steps:
- name: Check node.js version
id: check_node_version
run: |
# Determine which NodeVersion input to use
if [ -n "${{ github.event.inputs.NodeVersion }}" ]; then
NODE_VERSION="${{ github.event.inputs.NodeVersion }}"
echo "Using NodeVersion from workflow_dispatch: $NODE_VERSION"
elif [ -n "${{ inputs.NodeVersion }}" ]; then
NODE_VERSION="${{ inputs.NodeVersion }}"
echo "Using NodeVersion from workflow_call: $NODE_VERSION"
else
echo "Error: No NodeVersion specified"
exit 1
fi
# Set the output that will be used by subsequent steps/jobs
echo "NodeVersion=$NODE_VERSION" >> $GITHUB_OUTPUT
build:
name: Build node.js ${{github.event.inputs.NodeVersion}}
needs: [prebuild]
name: Build node.js ${{needs.prebuild.outputs.NodeVersion}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: |
NodeVersion="${{github.event.inputs.NodeVersion}}"
NodeVersion="${{needs.prebuild.outputs.NodeVersion}}"
PythonVersion="python3"
if [[ $NodeVersion = v12* ]]
then
@@ -25,31 +56,31 @@ jobs:
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 .
docker build --file Dockerfile --tag alpine_nodejs:${{needs.prebuild.outputs.NodeVersion}} --build-arg NodeVersion=${{needs.prebuild.outputs.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}}
docker run --rm -v $RUNNER_TEMP/alpine_node:/node_output alpine_nodejs:${{needs.prebuild.outputs.NodeVersion}}
ls -l -R $RUNNER_TEMP/alpine_node
- name: Upload alpine node.js
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: alpine_nodejs_${{github.event.inputs.NodeVersion}}
path: ${{runner.temp}}/alpine_node/node-${{github.event.inputs.NodeVersion}}-alpine-x64.tar.gz
name: alpine_nodejs_${{needs.prebuild.outputs.NodeVersion}}
path: ${{runner.temp}}/alpine_node/node-${{needs.prebuild.outputs.NodeVersion}}-alpine-x64.tar.gz
test:
name: Test node.js ${{github.event.inputs.NodeVersion}}
needs: [build]
name: Test node.js ${{needs.prebuild.outputs.NodeVersion}}
needs: [prebuild, build]
runs-on: ubuntu-latest
container: alpine
steps:
- name: Download alpine node.js
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: alpine_nodejs_${{github.event.inputs.NodeVersion}}
name: alpine_nodejs_${{needs.prebuild.outputs.NodeVersion}}
- run: |
ls -l
tar xzf ./node-${{github.event.inputs.NodeVersion}}-alpine-x64.tar.gz
tar xzf ./node-${{needs.prebuild.outputs.NodeVersion}}-alpine-x64.tar.gz
ls -l -R
./bin/node -v
./bin/node -e "console.log('hello world')"
@@ -57,25 +88,25 @@ jobs:
ldd ./bin/node
name: Test node
release:
name: Create release for node.js ${{github.event.inputs.NodeVersion}}
needs: [test]
name: Create release for node.js ${{needs.prebuild.outputs.NodeVersion}}
needs: [prebuild, test]
runs-on: ubuntu-latest
steps:
- name: Download alpine node.js
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: alpine_nodejs_${{github.event.inputs.NodeVersion}}
name: alpine_nodejs_${{needs.prebuild.outputs.NodeVersion}}
# Create GitHub release
- uses: actions/create-release@master
id: createRelease
name: Create node.js ${{github.event.inputs.NodeVersion}} Alpine Release
name: Create node.js ${{needs.prebuild.outputs.NodeVersion}} Alpine Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "${{github.event.inputs.NodeVersion}}"
release_name: "${{github.event.inputs.NodeVersion}}"
tag_name: "${{needs.prebuild.outputs.NodeVersion}}"
release_name: "${{needs.prebuild.outputs.NodeVersion}}"
body: |
Alpine node.js ${{github.event.inputs.NodeVersion}}
Alpine node.js ${{needs.prebuild.outputs.NodeVersion}}
# Upload release assets
- name: Upload Release Asset
uses: actions/upload-release-asset@v1.0.1
@@ -83,6 +114,6 @@ jobs:
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_path: ${{ github.workspace }}/node-${{needs.prebuild.outputs.NodeVersion}}-alpine-x64.tar.gz
asset_name: node-${{needs.prebuild.outputs.NodeVersion}}-alpine-x64.tar.gz
asset_content_type: application/octet-stream

View File

@@ -0,0 +1,80 @@
name: Build and Release Alpine Node.js on Schedule
permissions:
contents: write
on:
schedule:
- cron: '0 0 * * 0' # Every Sunday at midnight
workflow_dispatch:
jobs:
get_versions:
outputs:
versions: ${{ steps.set-matrix.outputs.versions }}
buildnode: ${{ steps.set-matrix.outputs.buildnode }}
name: Find versions to build and release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Find latest versions from each major version
id: set-matrix
run: |
BUILD_NODE=0
# Read major versions from versions.json
MAJOR_VERSIONS=$(jq -r '.[]' versions.json)
# Initialize array to store latest versions
LATEST_VERSIONS=()
# For each major version, find the latest release
for VERSION in $MAJOR_VERSIONS; do
# Get latest release for this major version
LATEST=$(curl -s "https://nodejs.org/dist/index.json" | \
jq -r "[.[] | select(.version | startswith(\"$VERSION.\"))] | sort_by(.date) | reverse | .[0].version")
if [ -n "$LATEST" ]; then
echo "Found latest $VERSION: $LATEST"
# Check if this version already exists in GitHub releases
# Using the GitHub API to check if the tag/release exists
RELEASE_EXISTS=$(curl -s -H "Authorization: token ${{github.token}}" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${LATEST}" | \
jq -r '.id != null')
if [ "$RELEASE_EXISTS" == "true" ]; then
echo "Release for $LATEST already exists - skipping"
else
echo "Release for $LATEST does not exist - will build"
LATEST_VERSIONS+=("$LATEST")
BUILD_NODE=1
fi
else
echo "No version found for $VERSION"
fi
done
# Create properly escaped JSON for GitHub Actions
MATRIX_JSON=$(jq -c -n --argjson versions "$(printf '%s\n' "${LATEST_VERSIONS[@]}" | jq -R . | jq -s .)" '{"node_version":$versions}')
echo "Matrix JSON: $MATRIX_JSON"
# Setting output with proper delimiter for multiline values
echo "versions<<EOF" >> $GITHUB_OUTPUT
echo "$MATRIX_JSON" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "buildnode=$BUILD_NODE" >> $GITHUB_OUTPUT
build_release:
name: Build and Release Node.js
needs: get_versions
if: needs.get_versions.outputs.buildnode == 1
strategy:
matrix: ${{ fromJSON(needs.get_versions.outputs.versions) }}
uses: ./.github/workflows/build-release-alpine-nodejs.yml
permissions:
contents: write
with:
NodeVersion: ${{ matrix.node_version }}

19
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,19 @@
# Contributing
## Submitting a pull request
1. Fork and clone the repository
1. Create a new branch: `git checkout -b my-branch-name`
1. Push to your fork and submit a pull request
1. Pat yourself on the back and wait for your pull request to be reviewed and merged
## Tips for working this repository:
> - The repository is huge right now, you don't want to waste your time and disk space to get those unrelated files.
> - Ignore LFS files during initial `git clone` the repo with `GIT_LFS_SKIP_SMUDGE=1 git clone https://mseng@dev.azure.com/mseng/AzureDevOps/_git/CIPlat.Externals`
> - Ignore LFS files during any `git checkout` or `git fetch` operation with `GIT_LFS_SKIP_SMUDGE=1`.
> - You do want the LFS smudge filter to run during `git add` and `git push`, make sure you don't have `GIT_LFS_SKIP_SMUDGE=1` when you run `git add` and `git push`.
> - More `Git-LFS` doc is at https://github.com/git-lfs/git-lfs/tree/main/docs
Thanks! :heart: :heart: :heart:
GitHub Actions Team :octocat:

View File

@@ -1,8 +1,11 @@
# alpine_nodejs
# GitHub Alpine NodeJS
[GitHub Actions Runner](https://github.com/actions/runner/blob/main/src/Misc/externals.sh) download alpine node.js from https://vstsagenttools.blob.core.windows.net/tools/nodejs
[![Actions Status](https://github.com/actions/alpine_nodejs/workflows/Build%20Alpine%20Node.js/badge.svg)](https://github.com/actions/alpine_nodejs/actions)
The [workflow](https://github.com/TingluoHuang/alpine_nodejs/actions/workflows/docker-image.yml) in this repository can compile a partial-static node.js for alpine and create a [GitHub release](https://github.com/TingluoHuang/alpine_nodejs/releases) for it.
The Alpine NodeJS repo houses a redistribution of NodeJS builds that are used within the [GitHub Actions Runner](https://github.com/actions/runner/blob/main/src/Misc/externals.sh).
## Getting Started
The [workflow](https://github.com/actions/alpine_nodejs/actions/workflows/docker-image.yml) in this repository can compile a partial-static node.js for alpine and create a [GitHub release](https://github.com/actions/alpine_nodejs/releases) for it.
- Queue workflow using `workflow_dispatch` trigger and set the `node` version you want to compile as input, ex: `v12.22.7`
![queue workflow](./res/queueWorkflow.png)
@@ -13,10 +16,3 @@ The [workflow](https://github.com/TingluoHuang/alpine_nodejs/actions/workflows/d
- There should be a newly created release that matches the version you want for `node`, and it is able to run on alpine.
![new release](./res/createdRelease.png)
- Once we get [approval](https://github.com/github/open-source-releases/issues/205) to change the current repository from `private` to `public`, then we can consume the release assets directly. In the meantime, you will need to follow [instructions](https://dev.azure.com/mseng/AzureDevOps/_wiki/wikis/AzureDevOps.wiki/4037/How-to-upload-resource-to-vstsagenttools.blob.core.windows.net) to check-in the compiled alpine node.js from the release assets as a `Git-LFS` files to https://dev.azure.com/mseng/AzureDevOps/_git/CIPlat.Externals and get it mirror into https://vstsagenttools.blob.core.windows.net/tools/nodejs
> Tips for working with `CIPlat.Externals` repository:
> - The repository is huge right now, you don't want to waste your time and disk space to get those unrelated files.
> - Ignore LFS files during initial `git clone` the repo with `GIT_LFS_SKIP_SMUDGE=1 git clone https://mseng@dev.azure.com/mseng/AzureDevOps/_git/CIPlat.Externals`
> - Ignore LFS files during any `git checkout` or `git fetch` operation with `GIT_LFS_SKIP_SMUDGE=1`.
> - You do want the LFS smudge filter to run during `git add` and `git push`, make sure you don't have `GIT_LFS_SKIP_SMUDGE=1` when you run `git add` and `git push`.
> - More `Git-LFS` doc is at https://github.com/git-lfs/git-lfs/tree/main/docs

12
SUPPORT.md Normal file
View File

@@ -0,0 +1,12 @@
# Support
## How to file issues and get help
This project does not support issues, however you may submit a pull request with any proposed improvements.
`actions/alpine_nodejs` is under active development and maintained by GitHub staff **AND THE COMMUNITY**. We will do our best to respond to support, feature requests, and community questions in a timely manner.
## GitHub Support Policy
Support for this project is limited to the resources listed above.

4
versions.json Normal file
View File

@@ -0,0 +1,4 @@
[
"v20",
"v24"
]