npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@technote-space/release-github-actions

v8.0.3

Published

GitHub actions to auto release.

Downloads

115

Readme

Release GitHub Actions

CI Status codecov CodeFactor License: MIT

Read this in other languages: English, 日本語.

これは GitHub Actions のリリースを自動化するための GitHub Actions です。
タグを作成するとこのアクションは自動で以下を行います。

  1. ビルド実行
  2. リリース用ブランチ作成
  3. リリース用ブランチにタグを張り替え
  4. 同じタグ名 かつ 公開済みのリリースが存在する場合、再度公開 (タグを張り替えた場合、リリースが下書き状態になるため)

Table of Contents

generated with TOC Generator

使用方法

例:.github/workflows/release.yml

#on:
#  push:
#    tags:
#      - "v*"

on: create

name: Release
jobs:
  release:
    name: Release GitHub Actions
    runs-on: ubuntu-latest
    steps:
      - uses: technote-space/release-github-actions@v6

対象イベントの詳細

CLI ツール

technote-space/release-github-actions-cli - GitHub

スクリーンショット

Release

オプション

| name | description | default | required | e.g. | |:---:|:---|:---:|:---:|:---:| | BUILD_COMMAND | ビルド用コマンドコマンドの詳細 | | | yarn build:all | | CLEAN_TARGETS | リリース前に掃除するファイルやディレクトリ (カンマ区切り)絶対パスや .. は使用できませんコマンドの詳細 |.[!.]*,__tests__,docs,src,*.[jt]s,*.[mc][jt]s,*.json,*.lock,*.yml,*.yaml | true | .[!.]*,*.txt | | PACKAGE_MANAGER | 依存関係のインストールに使用するパッケージマネージャーyarn.lockpackage-lock.json がある場合は自動で使用するパッケージマネージャーを決定しますが、このオプションで強制することができますnpm または yarn) | | | yarn | | COMMIT_MESSAGE | コミット時に設定するメッセージ | feat: build for release | true | feat: release | | COMMIT_NAME | コミット時に設定する名前 | github-actions[bot] | true | | | COMMIT_EMAIL | コミット時に設定する名前 | 41898282+github-actions[bot]@users.noreply.github.com | true | | | BRANCH_NAME | GitHub Actions 用のブランチ名 | gh-actions | true | gh-actions/${MAJOR}/${MINOR}/${PATCH} | | BUILD_COMMAND_TARGET | ビルド用コマンド検索ターゲット | prepare, build, production, prod, package, pack | | compile | | ALLOW_MULTIPLE_BUILD_COMMANDS | 複数のビルドコマンド実行を許可するかどうか | true | | false | | CREATE_MAJOR_VERSION_TAG | メジャーバージョンタグ(例:v1)を作成するかどうかタグの詳細 | true | | false | | CREATE_MINOR_VERSION_TAG | マイナーバージョンタグ(例:v1.2)を作成するかどうかタグの詳細 | true | | false | | CREATE_PATCH_VERSION_TAG | パッチバージョンタグ(例:v1.2.3)を作成するかどうかタグの詳細 | true | | false | | FETCH_DEPTH | 取得するコミット履歴の制限数 | 3 | | 5 | | TEST_TAG_PREFIX | テスト用タグのプリフィックス | | | test/ | | CLEAN_TEST_TAG | テストタグを掃除するかどうか | false | | true | | ORIGINAL_TAG_PREFIX | 元のタグを残す際に付与するプリフィックス | | | original/ | | DELETE_NODE_MODULES | node_modules を削除するかどうか | false | | true | | GITHUB_TOKEN | アクセストークン | ${{github.token}} | true | ${{secrets.ACCESS_TOKEN}} |

Execute commands

ビルド

  • preparebuildproductionprodpackage または pack が package.json の scripts に含まれる場合、ビルド用のコマンドとしてそれらを使用します。(BUILD_COMMAND_TARGET で変更可能です)
  • npm run installyarn install のようなインストール用コマンドが存在しない場合、インストール用コマンドが追加されます。

したがって、BUILD_COMMAND が設定されていない かつ package.json に build が存在する場合、以下のコマンドが実行されます。

yarn install
yarn build
yarn install --production

buildpack が含まれる場合は、以下のコマンドになります。

yarn install
yarn build
yarn pack
yarn install --production

ファイル削除

GitHub Actions の実行には「ビルドに使用するソース」や「テストファイル」、「テストの設定」などを必要としません。
そして GitHub Actions は使用されるたびにダウンロードされるため、ファイルは少ないほうが良いです。

CLEAN_TARGETS オプションはこの目的のために使用されます。
default: .[!.]*,__tests__,docs,src,*.[jt]s,*.[mc][jt]s,*.json,*.lock,*.yml,*.yaml

rm -rdf .[!.]*
rm -rdf *.js
rm -rdf *.mjs
rm -rdf *.ts
rm -rdf *.cts
rm -rdf *.json
rm -rdf *.lock
rm -rdf *.yml
rm -rdf *.yaml
rm -rdf __tests__ docs src

(action.yml は削除の対象ではありません)

Action イベント詳細

対象イベント

| eventName: action | condition | |:---:|:---:| |push: *|condition| |release: published|condition| |create: *|condition|

condition

  • tags

動機

GitHub Actionsをリリースするには、すべてのビルドファイルと node_modules のような依存関係が必要ですが、通常はそれらをコミットしません。
したがってGitHub Actionsリリースする際には以下のような手順が必要です。

  1. ローカルの開発用ブランチで開発
  2. リリース用にビルド
  3. node_modules のような依存モジュールを含めて必要なソースをリリース用ブランチにコミット
  4. タグを付与 (メジャー、マイナー、パッチバージョンの考慮が必要)
  5. GitHub にプッシュ
  6. リリースを作成

リリースの度にこれらの手順を実行するのはとても面倒です。

この GitHub Actions を使用することで手順は単純になります。

  1. ローカルの開発用ブランチで開発
  2. リリースを作成 (タグを作成)
  3. 自動化された手順が完了するのを待つ
    1. リリース用にビルド
    2. node_modules のような依存モジュールを含めて必要なソースをリリース用ブランチにコミット
    3. タグを付与 (メジャー、マイナー、パッチバージョンの考慮が必要)
    4. GitHub にプッシュ

補足

Tags

タグ名は Semantic Versioning に従っている必要があります。
以下のタグが作成されます。

  • 指定されたタグ名
  • メジャーバージョンのタグ名 (指定されたタグ名から生成)
    • 例:v1
  • マイナーバージョンのタグ名 (指定されたタグ名から生成)
    • 例:v1.2
  • パッチバージョンのタグ名 (指定されたタグ名から生成)
    • 例:v1.2.3

Author

GitHub (Technote)
Blog