Skip to content

rizqyfahmi is automatically publishing #26

rizqyfahmi is automatically publishing

rizqyfahmi is automatically publishing #26

Workflow file for this run

name: CI Pipeline
run-name: ${{ github.actor }} is automatically publishing
on:
push:
branches:
- master
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 24.4.1
- name: Install dependencies
run: npm install
- name: Run lint
run: npm run lint
test:
needs: [lint]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 24.4.1
- name: Install dependencies
run: npm install
- name: Run tests with coverage
run: npm run test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
publish:
needs: [test]
permissions:
id-token: write
contents: write
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Decode the GitHub App Private Key
id: decode
run: |
private_key=$(echo "${{ secrets.BOT_PRIVATE_KEY }}" | base64 -d | awk 'BEGIN {ORS="\\n"} {print}' | head -c -2) &> /dev/null
echo "::add-mask::$private_key"
echo "private-key=$private_key" >> "$GITHUB_OUTPUT"
- name: 'Generate token'
id: GENERATE_TOKEN
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ steps.decode.outputs.private-key }}
- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.GENERATE_TOKEN.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.GENERATE_TOKEN.outputs.token }}
- name: Set global username and email
run: |
git config --global user.name '${{ steps.GENERATE_TOKEN.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.GENERATE_TOKEN.outputs.app-slug }}[bot]@users.noreply.github.com'
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 24.4.1
- name: Install dependencies
run: npm install
- name: Build package
run: npm run build
- name: Pack npm package
run: npm pack
- name: List contents (for debugging)
run: ls -l
- name: Sign package
uses: sigstore/gh-action-sigstore-python@v3.0.1
with:
inputs: "*.tgz"
- name: Debug auth
run: |
curl -s -H "Authorization: token ${{ steps.GENERATE_TOKEN.outputs.token }}" https://api.github.com/user
- name: Run Semantic Release
env:
GITHUB_TOKEN: ${{ steps.GENERATE_TOKEN.outputs.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release