Bump the github-actions-all group with 2 updates #1533
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: "Main" | |
on: | |
push: | |
tags: ["*"] | |
branches: ["*"] | |
pull_request: | |
branches: ["*"] | |
schedule: | |
- cron: "25 12 * * 3" | |
workflow_dispatch: | |
permissions: {} | |
jobs: | |
lint: | |
name: "Lint" | |
runs-on: "ubuntu-latest" | |
permissions: | |
contents: "read" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" | |
- name: "Use Node.js lts/*" | |
uses: "actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b" | |
with: | |
node-version: "lts/*" | |
cache: "npm" | |
- name: "Install dependencies" | |
run: "npm ci" | |
- name: "Lint" | |
run: "npm run lint" | |
test-node: | |
name: "Test on Node.js ${{ matrix.node_version }} on ${{ matrix.os }}" | |
needs: ["lint"] | |
runs-on: "${{ matrix.os }}" | |
permissions: | |
contents: "read" | |
strategy: | |
fail-fast: false | |
matrix: | |
node_version: ["lts/-1", "lts/*", "current"] | |
os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" | |
- name: "Use Node.js ${{ matrix.node_version }}" | |
uses: "actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b" | |
with: | |
node-version: "${{ matrix.node_version }}" | |
cache: "npm" | |
- name: "Install dependencies" | |
run: "npm ci" | |
- name: "Test" | |
run: "npm run test:node" | |
test-bun: | |
name: "Test on Bun ${{ matrix.bun_version }} on ${{ matrix.os }}" | |
needs: ["lint"] | |
runs-on: "${{ matrix.os }}" | |
permissions: | |
contents: "read" | |
strategy: | |
fail-fast: false | |
matrix: | |
bun_version: ["latest"] | |
os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" | |
- name: "Use Bun ${{ matrix.bun_version }}" | |
uses: "oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5" | |
with: | |
bun-version: "${{ matrix.bun_version }}" | |
- name: "Install dependencies" | |
run: "bun install --frozen-lockfile" | |
- name: "Test" | |
run: "bun run test:bun" | |
build-dist: | |
name: "Build distribution files" | |
needs: ["test-node"] | |
runs-on: "ubuntu-latest" | |
permissions: | |
contents: "read" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" | |
- name: "Use Node.js lts/*" | |
uses: "actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b" | |
with: | |
node-version: "lts/*" | |
cache: "npm" | |
- name: "Install dependencies" | |
run: "npm ci" | |
- name: "Build" | |
run: | | |
npm run build | |
for f in ./dist/*-linuxstatic-*; do gzip -n "${f:?}"; done | |
for f in ./dist/*-win-*.exe; do zip -mj "${f:?}.zip" "${f:?}"; done | |
- name: "Upload artifacts" | |
uses: "actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b" | |
with: | |
name: "dist" | |
path: | | |
./dist/*.js | |
./dist/*.gz | |
./dist/*.zip | |
retention-days: 1 | |
build-docker: | |
name: "Build Docker image for ${{ matrix.runtime.name }} (${{ matrix.platform.arch }})" | |
needs: ["test-node", "test-bun"] | |
runs-on: "ubuntu-latest" | |
permissions: | |
contents: "read" | |
strategy: | |
fail-fast: false | |
matrix: | |
runtime: | |
- id: "node" | |
name: "Node.js" | |
dockerfile: "./Dockerfile" | |
- id: "bun" | |
name: "Bun" | |
dockerfile: "./Dockerfile.bun" | |
platform: | |
- id: "linux-amd64" | |
arch: "linux/amd64" | |
- id: "linux-arm64-v8" | |
arch: "linux/arm64/v8" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" | |
- name: "Export runtime variables" | |
uses: "hectorm/ghaction-runtime-export@c8ec870e62dd2ab91765f8a65e244c3ce842227c" | |
- name: "Set up Docker Buildx" | |
uses: "hectorm/ghaction-docker-buildx-setup@fec3efdbb455c2aa58a4fbfd11a9853f5de2cdba" | |
- name: "Build" | |
uses: "hectorm/ghaction-docker-buildx-build@298dc8203fa9957709e55a37b4b40181618205bb" | |
with: | |
dockerfile: "${{ matrix.runtime.dockerfile }}" | |
platforms: "${{ matrix.platform.arch }}" | |
cache-from: "type=gha,scope=${{ matrix.runtime.id }}-${{ matrix.platform.id }}" | |
cache-to: "type=gha,scope=${{ matrix.runtime.id }}-${{ matrix.platform.id }},mode=max" | |
publish-docker: | |
name: "Publish Docker images" | |
if: "startsWith(github.ref, 'refs/tags/v') || github.ref_name == github.event.repository.default_branch" | |
needs: ["build-dist", "build-docker"] | |
runs-on: "ubuntu-latest" | |
permissions: | |
contents: "read" | |
packages: "write" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" | |
- name: "Export runtime variables" | |
uses: "hectorm/ghaction-runtime-export@c8ec870e62dd2ab91765f8a65e244c3ce842227c" | |
- name: "Set up Docker Buildx" | |
uses: "hectorm/ghaction-docker-buildx-setup@fec3efdbb455c2aa58a4fbfd11a9853f5de2cdba" | |
- name: "Login to GitHub Container Registry" | |
if: "github.event_name != 'pull_request'" | |
uses: "docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446" | |
with: | |
registry: "ghcr.io" | |
username: "${{ github.actor }}" | |
password: "${{ secrets.GITHUB_TOKEN }}" | |
- name: "Login to Docker Hub" | |
if: "github.event_name != 'pull_request'" | |
uses: "docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446" | |
with: | |
registry: "docker.io" | |
username: "${{ secrets.DOCKERHUB_USERNAME }}" | |
password: "${{ secrets.DOCKERHUB_TOKEN }}" | |
- name: "Extract metadata" | |
id: "meta" | |
uses: "docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81" | |
with: | |
images: | | |
ghcr.io/${{ github.repository }} | |
docker.io/${{ github.repository }} | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern=v{{version}} | |
type=semver,pattern=v{{major}}.{{minor}} | |
type=semver,pattern=v{{major}} | |
- name: "Push" | |
uses: "hectorm/ghaction-docker-buildx-build@298dc8203fa9957709e55a37b4b40181618205bb" | |
with: | |
dockerfile: "./Dockerfile" | |
platforms: | | |
linux/amd64 | |
linux/arm64/v8 | |
tags: | | |
${{ steps.meta.outputs.tags }} | |
labels: | | |
${{ steps.meta.outputs.labels }} | |
push: "${{ github.event_name != 'pull_request' }}" | |
cache-from: | | |
type=gha,scope=node-linux-amd64 | |
type=gha,scope=node-linux-arm64-v8 | |
publish-npm: | |
name: "Publish npm package" | |
if: "startsWith(github.ref, 'refs/tags/v')" | |
needs: ["build-dist", "build-docker"] | |
runs-on: "ubuntu-latest" | |
permissions: | |
contents: "read" | |
id-token: "write" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" | |
- name: "Use Node.js lts/*" | |
uses: "actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b" | |
with: | |
node-version: "lts/*" | |
registry-url: "https://registry.npmjs.org" | |
- name: "Publish" | |
env: | |
NODE_AUTH_TOKEN: "${{ secrets.NPM_TOKEN }}" | |
run: | | |
PKG_NAME="$(jq -r '.name' ./package.json)"; PKG_VERSION="$(jq -r '.version' ./package.json)" | |
if [ "$(npm view "${PKG_NAME:?}" versions --json | jq -r --arg v "${PKG_VERSION:?}" 'index($v)')" = 'null' ]; then | |
npm publish --provenance --access public | |
fi | |
publish-github-release: | |
name: "Publish GitHub release" | |
if: "startsWith(github.ref, 'refs/tags/v')" | |
needs: ["build-dist", "build-docker"] | |
runs-on: "ubuntu-latest" | |
permissions: | |
contents: "write" | |
steps: | |
- name: "Download artifacts" | |
uses: "actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16" | |
with: | |
name: "dist" | |
path: "assets" | |
- name: "Publish" | |
uses: "hectorm/ghaction-release@066200d04c3549852afa243d631ea3dc93390f68" | |
with: | |
assets-path: "./assets/" |