Skip to content

Commit

Permalink
ci: update main workflow (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeadNews committed Sep 24, 2023
1 parent 0c2ac77 commit 9b99ca3
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Main

on:
push:
branches: [main]
tags:
- "v*"
pull_request:
branches: [main]

permissions:
contents: read

jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@a1800f471a0bc25cddac36bb13e6f436ddf341d7 # v1
with:
bun-version: latest

- name: Run tests
run: bun test

publish:
name: Publish Package to npmjs
if: startsWith(github.ref, 'refs/tags/')
needs: [tests]
environment: publish
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Bun
uses: oven-sh/setup-bun@a1800f471a0bc25cddac36bb13e6f436ddf341d7 # v1
with:
bun-version: latest

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: latest
registry-url: https://registry.npmjs.org

- name: Install dependencies
run: bun install

- name: Publish to npmjs
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create GitHub release
run: bunx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

> TypeScript Project Template
[![npm](https://img.shields.io/npm/v/deadnews-template-typescript)](https://www.npmjs.com/package/deadnews-template-typescript)
[![pre-commit.ci](https://results.pre-commit.ci/badge/github/DeadNews/deadnews-template-typescript/main.svg)](https://results.pre-commit.ci/latest/github/DeadNews/deadnews-template-typescript/main)
[![Docker](https://github.com/DeadNews/deadnews-template-typescript/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/DeadNews/deadnews-template-typescript/actions/workflows/docker-publish.yml)
[![image-size](https://ghcr-badge.egpl.dev/DeadNews/deadnews-template-typescript/size)](https://github.com/DeadNews/deadnews-template-typescript/pkgs/container/deadnews-template-typescript)
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"name": "deadnews-template-typescript",
"version": "0.1.2",
"description": "TypeScript Project Template",
"publisher": "DeadNews <aurczpbgr@mozmail.com>",
"homepage": "https://github.com/DeadNews/deadnews-template-typescript",
"license": "MIT",
"module": "src/index.ts",
"type": "module",
Expand Down

0 comments on commit 9b99ca3

Please sign in to comment.