Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(js-release): add js-release pipeline #3

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/js-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: js-release
on:
workflow_call:
inputs:
PRIMUS_REF:
description: 'The primus ref to checkout.'
required: true
default: 'main'
type: string
Comment on lines +1 to +9
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Resolve contradictory input configuration for PRIMUS_REF

The PRIMUS_REF input is marked as both required: true and has a default value. This configuration is contradictory because if an input is required, its default value will never be used.

To resolve this, choose one of the following options:

  1. If the input should be optional with a default value:
PRIMUS_REF:
  description: 'The primus ref to checkout.'
  required: false
  default: 'main'
  type: string
  1. If the input should be required without a default:
PRIMUS_REF:
  description: 'The primus ref to checkout.'
  required: true
  type: string
🧰 Tools
actionlint

8-8: input "PRIMUS_REF" of workflow_call event has the default value "main", but it is also required. if an input is marked as required, its default value will never be used

(events)


defaults:
run:
shell: bash

env:
PRIMUS_HOME: .primus
MAKE: make --no-print-directory --makefile=.primus/src/make/main.mk

jobs:
release:
runs-on: ubuntu-latest
environment: ${{ github.ref_type == 'tag' && 'production' || github.ref_name == 'main' && 'staging' || 'review' }}
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: self-checkout
uses: actions/checkout@v4
- id: token
name: github-token-gen
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.PRIMUS_APP_ID }}
private-key: ${{ secrets.PRIMUS_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: primus-checkout
uses: actions/checkout@v4
with:
repository: signoz/primus
ref: ${{ inputs.PRIMUS_REF }}
path: .primus
token: ${{ steps.token.outputs.token }}
- name: info
run: |
$MAKE info
- name: pnpm-install
uses: pnpm/action-setup@v3
with:
version: 8
- name: node-install
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
Comment on lines +50 to +54
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider using a version range for Node.js

The Node.js version is currently hardcoded to 20. To ensure compatibility with future versions while maintaining stability, consider using a version range.

- node-version: 20
+ node-version: '20.x'

This change allows for minor version updates within the Node.js 20.x range.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: node-install
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: node-install
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: "pnpm"

- name: deps-install
run: pnpm install
- name: setup-git
run: |
$MAKE git-user
- name: create-release
uses: changesets/action@v1
with:
publish: pnpm release
setupGitUser: false
env:
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
NPM_TOKEN: ${{ secrets.PRIMUS_NPM_TOKEN }}