-
Notifications
You must be signed in to change notification settings - Fork 31
70 lines (67 loc) · 2.8 KB
/
build-static-node.yml
File metadata and controls
70 lines (67 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Build Static Node.js Container
on:
pull_request:
paths:
- '.github/workflows/build-static-node.yml'
- 'staticnode/**'
push:
branches:
- main
paths:
- '.github/workflows/build-static-node.yml'
- 'staticnode/**'
jobs:
load-node-versions:
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.load-versions.outputs.versions }}
steps:
- uses: actions/checkout@v6.0.2
with:
persist-credentials: false
- name: Load Node.js versions
id: load-versions
run: |
echo "versions=$(cat staticnode/node-versions.json | jq -c '.')" >> $GITHUB_OUTPUT
build:
runs-on: ${{ matrix.IMAGE.RUNNER }}
needs: load-node-versions
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
IMAGE:
- {RUNNER: "ubuntu-latest", MANYLINUX_ARCH: "x86_64"}
- {RUNNER: "ubuntu-24.04-arm", MANYLINUX_ARCH: "aarch64"}
- {RUNNER: "ubuntu-24.04-ppc64le", MANYLINUX_ARCH: "ppc64le"}
NODE_CONFIG: ${{ fromJson(needs.load-node-versions.outputs.versions) }}
steps:
- uses: actions/checkout@v6.0.2
with:
persist-credentials: false
- name: Set Node.js version
run: |
echo "NODE_VERSION=${{ matrix.NODE_CONFIG.version }}" >> $GITHUB_ENV
echo "NODE_SHA256SUM=${{ matrix.NODE_CONFIG.sha256sum }}" >> $GITHUB_ENV
arch=$(echo "${{ runner.arch }}" | tr '[:upper:]' '[:lower:]')
echo "NODE_ARCH=$arch" >> $GITHUB_ENV
- name: Build the Docker image
run: |
echo building node.js $NODE_VERSION
docker build --tag ghcr.io/pyca/static-nodejs-$NODE_ARCH:$NODE_VERSION --build-arg VERSION=$NODE_VERSION --build-arg ARCH=$NODE_ARCH --build-arg SHA256SUM=$NODE_SHA256SUM staticnode
- name: Test static node.js on manylinux2014
run: |
cd staticnode
docker build -f Dockerfile-test -t test-node --build-arg MANYLINUX_ARCH=${{ matrix.IMAGE.MANYLINUX_ARCH }} --build-arg CONTAINER_NAME=ghcr.io/pyca/static-nodejs-$NODE_ARCH:$NODE_VERSION .
docker run test-node /staticnode/bin/node -e "console.log('hello world'); console.log(process.version)"
- name: Login to docker
run: 'docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" ghcr.io'
env:
DOCKER_USERNAME: ${{ github.actor }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main'
- name: Push image
run: docker push "ghcr.io/pyca/static-nodejs-${NODE_ARCH}:${NODE_VERSION}"
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main'