Compare commits
4 Commits
e8adccfbbf
...
v0.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 283f91ed91 | |||
| 5991e4f1f0 | |||
| 0dc657c97b | |||
| 96d0568197 |
@@ -6,37 +6,47 @@ on:
|
|||||||
- 'v*'
|
- 'v*'
|
||||||
- '[0-9]*'
|
- '[0-9]*'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
verify:
|
verify:
|
||||||
name: verify
|
name: verify
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: node:20-bookworm
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Install release tools
|
||||||
uses: actions/checkout@v4
|
run: |
|
||||||
with:
|
set -euo pipefail
|
||||||
fetch-depth: 0
|
apt-get update
|
||||||
|
apt-get install -y git curl ca-certificates
|
||||||
|
curl -fsSL https://bun.sh/install | bash -s -- bun-v1.3.13
|
||||||
|
install -m 0755 /root/.bun/bin/bun /usr/local/bin/bun
|
||||||
|
node --version
|
||||||
|
npm --version
|
||||||
|
bun --version
|
||||||
|
|
||||||
- name: Set up Node.js
|
- name: Clone tagged source
|
||||||
uses: actions/setup-node@v4
|
run: |
|
||||||
with:
|
set -euo pipefail
|
||||||
node-version: '20'
|
REPO_URL="${{ gitea.server_url }}/${{ gitea.repository }}.git"
|
||||||
registry-url: 'https://registry.npmjs.org'
|
AUTH_HEADER="$(printf '%s' '${{ gitea.actor }}:${{ secrets.GITEA_TOKEN }}' | base64 -w0)"
|
||||||
|
git -c http.extraHeader="Authorization: Basic $AUTH_HEADER" clone --depth 1 --branch "${{ gitea.ref_name }}" "$REPO_URL" repo
|
||||||
- name: Set up Bun
|
git -C repo rev-parse HEAD
|
||||||
uses: oven-sh/setup-bun@v2
|
|
||||||
with:
|
|
||||||
bun-version: '1.3.13'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: bun install --frozen-lockfile
|
|
||||||
|
|
||||||
- name: Verify release tag matches package version
|
- name: Verify release tag matches package version
|
||||||
|
working-directory: repo
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
TAG_NAME="${GITHUB_REF##refs/tags/}"
|
TAG_NAME="${{ gitea.ref_name }}"
|
||||||
PACKAGE_VERSION="$(node -p "require('./package.json').version")"
|
PACKAGE_VERSION="$(node -p "require('./package.json').version")"
|
||||||
|
|
||||||
if [ "$TAG_NAME" = "v$PACKAGE_VERSION" ] || [ "$TAG_NAME" = "$PACKAGE_VERSION" ]; then
|
if [ "$TAG_NAME" = "v$PACKAGE_VERSION" ] || [ "$TAG_NAME" = "$PACKAGE_VERSION" ]; then
|
||||||
@@ -48,7 +58,10 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
- name: Run verify pipeline
|
- name: Run verify pipeline
|
||||||
|
working-directory: repo
|
||||||
run: |
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
bun install --frozen-lockfile
|
||||||
bun run test
|
bun run test
|
||||||
bun run check
|
bun run check
|
||||||
bun run build
|
bun run build
|
||||||
@@ -56,32 +69,49 @@ jobs:
|
|||||||
release:
|
release:
|
||||||
name: publish to npm
|
name: publish to npm
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: node:20-bookworm
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
needs:
|
needs:
|
||||||
- verify
|
- verify
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Install release tools
|
||||||
uses: actions/checkout@v4
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y git curl ca-certificates
|
||||||
|
curl -fsSL https://bun.sh/install | bash -s -- bun-v1.3.13
|
||||||
|
install -m 0755 /root/.bun/bin/bun /usr/local/bin/bun
|
||||||
|
node --version
|
||||||
|
npm --version
|
||||||
|
bun --version
|
||||||
|
|
||||||
- name: Set up Node.js
|
- name: Clone tagged source
|
||||||
uses: actions/setup-node@v4
|
run: |
|
||||||
with:
|
set -euo pipefail
|
||||||
node-version: '20'
|
REPO_URL="${{ gitea.server_url }}/${{ gitea.repository }}.git"
|
||||||
registry-url: 'https://registry.npmjs.org'
|
AUTH_HEADER="$(printf '%s' '${{ gitea.actor }}:${{ secrets.GITEA_TOKEN }}' | base64 -w0)"
|
||||||
|
git -c http.extraHeader="Authorization: Basic $AUTH_HEADER" clone --depth 1 --branch "${{ gitea.ref_name }}" "$REPO_URL" repo
|
||||||
- name: Set up Bun
|
git -C repo rev-parse HEAD
|
||||||
uses: oven-sh/setup-bun@v2
|
|
||||||
with:
|
|
||||||
bun-version: '1.3.13'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: bun install --frozen-lockfile
|
working-directory: repo
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
bun install --frozen-lockfile
|
||||||
|
|
||||||
- name: Build package
|
- name: Build package
|
||||||
run: bun run build
|
working-directory: repo
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
bun run build
|
||||||
|
|
||||||
- name: Publish package to npm
|
- name: Publish package to npm
|
||||||
|
working-directory: repo
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
run: npm publish
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
printf '//registry.npmjs.org/:_authToken=%s\n' "$NODE_AUTH_TOKEN" > ~/.npmrc
|
||||||
|
npm publish
|
||||||
|
|||||||
Reference in New Issue
Block a user