Skip to content

Fix zizmor warnings in github actions #35

Fix zizmor warnings in github actions

Fix zizmor warnings in github actions #35

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:
build:
name: Build node.js
runs-on: ${{ matrix.IMAGE.RUNNER }}
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
IMAGE:
- {RUNNER: "ubuntu-latest", MANYLINUX_ARCH: "x86_64"}
- {RUNNER: [self-hosted, Linux, ARM64], MANYLINUX_ARCH: "aarch64"}
steps:
- uses: actions/[email protected]
with:
persist-credentials: false
- name: Set Node.js version
run: |
source ./staticnode/node-version.sh
echo "NODE_VERSION=$NODE_VERSION" >> $GITHUB_ENV
echo "NODE_SHA256SUM=$NODE_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'