Docs: update #1365
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Node.js Compile | |
on: | |
pull_request: | |
types: | |
# - edited # PR's base branch was changed | |
- opened | |
- reopened | |
- synchronize # PR's branch was edited (i.e. new commits) | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag (e.g. "v1.0.0")' | |
required: true | |
type: string | |
concurrency: | |
group: ${{ github.workflow }}-${{ inputs.tag || github.ref }} | |
cancel-in-progress: true | |
env: | |
ref: ${{ inputs.tag && format('refs/tags/{0}',inputs.tag) || github.sha || github.ref }} | |
jobs: | |
path-filter: | |
permissions: | |
pull-requests: read | |
runs-on: ubuntu-latest | |
outputs: | |
changes: ${{ steps.filter.outputs.changes }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: filter | |
uses: dorny/paths-filter@v2 | |
with: | |
filters: | | |
changes: | |
- '.github/workflows/node-compile.yml' | |
- 'src/**' | |
- '*' | |
ref: ${{ env.ref }} | |
node-compile: | |
needs: | |
- path-filter | |
if: ${{ needs.path-filter.outputs.changes == 'true' || github.event_name != 'pull_request' }} | |
runs-on: ${{ matrix.os }} | |
name: node-compile (${{ matrix.os }} ${{ matrix.arch }}) | |
strategy: | |
matrix: | |
include: | |
# docker manifest inspect node:<version> | jq '.manifests[].platform' | |
- os: ubuntu-latest | |
arch: amd64 | |
build: | | |
NPM_PKG_VERSION=$(npm pkg get version | sed 's/"//g') | |
DOCKER_ARCH=amd64 | |
BIN_OUTPUT="igir-${NPM_PKG_VERSION}-${RUNNER_OS}-${DOCKER_ARCH/\//}.tar.gz" | |
echo "BIN_OUTPUT=${BIN_OUTPUT}" >> "${GITHUB_ENV}" | |
docker run --rm --platform "linux/${DOCKER_ARCH}" --volume "$(pwd):/app" --workdir "/app" \ | |
"node:$(jq --raw-output '.volta.node' package.json)" sh -c \ | |
"npm run package . igir" | |
tar cvf - igir | gzip --best > "${BIN_OUTPUT}" | |
{ | |
echo '```text' | |
ls -alh igir "${BIN_OUTPUT}" | |
echo '```' | |
} >> "${GITHUB_STEP_SUMMARY}" | |
- os: ubuntu-latest | |
arch: arm/v7 | |
build: | | |
NPM_PKG_VERSION=$(npm pkg get version | sed 's/"//g') | |
DOCKER_ARCH=arm/v7 | |
BIN_OUTPUT="igir-${NPM_PKG_VERSION}-${RUNNER_OS}-${DOCKER_ARCH/\//}.tar.gz" | |
echo "BIN_OUTPUT=${BIN_OUTPUT}" >> "${GITHUB_ENV}" | |
docker run --rm --platform "linux/${DOCKER_ARCH}" --volume "$(pwd):/app" --workdir "/app" \ | |
"node:$(jq --raw-output '.volta.node' package.json)" sh -c \ | |
"npm run package -- . igir" | |
tar cvf - igir | gzip --best > "${BIN_OUTPUT}" | |
{ | |
echo '```text' | |
ls -alh igir "${BIN_OUTPUT}" | |
echo '```' | |
} >> "${GITHUB_STEP_SUMMARY}" | |
- os: ubuntu-latest | |
arch: arm64/v8 | |
build: | | |
NPM_PKG_VERSION=$(npm pkg get version | sed 's/"//g') | |
DOCKER_ARCH=arm64/v8 | |
BIN_OUTPUT="igir-${NPM_PKG_VERSION}-${RUNNER_OS}-${DOCKER_ARCH/\//}.tar.gz" | |
echo "BIN_OUTPUT=${BIN_OUTPUT}" >> "${GITHUB_ENV}" | |
docker run --rm --platform "linux/${DOCKER_ARCH}" --volume "$(pwd):/app" --workdir "/app" \ | |
"node:$(jq --raw-output '.volta.node' package.json)" sh -c \ | |
"npm run package -- . igir" | |
tar cvf - igir | gzip --best > "${BIN_OUTPUT}" | |
{ | |
echo '```text' | |
ls -alh igir "${BIN_OUTPUT}" | |
echo '```' | |
} >> "${GITHUB_STEP_SUMMARY}" | |
- os: macos-13 | |
build: | | |
NPM_PKG_VERSION=$(npm pkg get version | sed 's/"//g') | |
NODE_ARCH=$(node --print 'process.arch') | |
BIN_OUTPUT="igir-${NPM_PKG_VERSION}-${RUNNER_OS}-${NODE_ARCH}.tar.gz" | |
echo "BIN_OUTPUT=${BIN_OUTPUT}" >> "${GITHUB_ENV}" | |
npm run package -- . igir | |
tar cvf - igir | gzip --best > "${BIN_OUTPUT}" | |
{ | |
echo '```text' | |
ls -alh igir "${BIN_OUTPUT}" | |
echo '```' | |
} >> "${GITHUB_STEP_SUMMARY}" | |
- os: macos-14 | |
build: | | |
NPM_PKG_VERSION=$(npm pkg get version | sed 's/"//g') | |
NODE_ARCH=$(node --print 'process.arch') | |
BIN_OUTPUT="igir-${NPM_PKG_VERSION}-${RUNNER_OS}-${NODE_ARCH}.tar.gz" | |
echo "BIN_OUTPUT=${BIN_OUTPUT}" >> "${GITHUB_ENV}" | |
npm run package -- . igir | |
tar cvf - igir | gzip --best > "${BIN_OUTPUT}" | |
{ | |
echo '```text' | |
ls -alh igir "${BIN_OUTPUT}" | |
echo '```' | |
} >> "${GITHUB_STEP_SUMMARY}" | |
- os: windows-latest | |
build: | | |
$NPM_PKG_VERSION=$(npm pkg get version).replace('"','') | |
$NODE_ARCH=$(node --print 'process.arch') | |
$BIN_OUTPUT="igir-$NPM_PKG_VERSION-${env:RUNNER_OS}-${NODE_ARCH}.zip" | |
echo "BIN_OUTPUT=${BIN_OUTPUT}" | Out-File -FilePath $env:GITHUB_ENV -Append # no need for -Encoding utf8 | |
npm run package -- . igir.exe | |
Compress-Archive -Path igir.exe -DestinationPath "${BIN_OUTPUT}" -CompressionLevel Optimal -Force | |
echo "``````text" >> "${env:GITHUB_STEP_SUMMARY}" | |
Get-ChildItem igir.exe >> "${env:GITHUB_STEP_SUMMARY}" | |
Get-ChildItem "${BIN_OUTPUT}" >> "${env:GITHUB_STEP_SUMMARY}" | |
echo "``````" >> "${env:GITHUB_STEP_SUMMARY}" | |
steps: | |
# Setup and install | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.ref }} | |
- if: matrix.os == 'ubuntu-latest' | |
uses: docker/setup-qemu-action@v3 | |
- uses: volta-cli/action@v4 | |
- run: npm ci | |
- run: npm run build | |
# Compile and upload | |
- run: ${{ matrix.build }} | |
- if: ${{ github.event_name != 'pull_request' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.BIN_OUTPUT }} | |
path: ${{ env.BIN_OUTPUT }} | |
if-no-files-found: error | |
release-update: | |
if: ${{ github.event_name != 'pull_request' }} | |
needs: | |
- node-compile | |
runs-on: ubuntu-latest | |
steps: | |
# Get the package version | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.ref }} | |
- uses: volta-cli/action@v4 | |
- run: npm ci | |
- run: echo "NPM_PKG_VERSION=$(npm pkg get version | sed 's/"//g')" >> "${GITHUB_ENV}" | |
# Download and update | |
- uses: actions/download-artifact@v4 | |
- uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: v${{ env.NPM_PKG_VERSION }} | |
files: igir-*/* | |
# !!! This check should be required by GitHub !!! | |
compile-status-check: | |
if: always() | |
needs: | |
- path-filter | |
- node-compile | |
runs-on: ubuntu-latest | |
steps: | |
- uses: re-actors/alls-green@release/v1 | |
with: | |
allowed-skips: node-compile | |
jobs: ${{ toJSON(needs) }} |