Skip to content

Commit

Permalink
Merge pull request #71 from gawaooooo-sandbox/docs/jekyll
Browse files Browse the repository at this point in the history
Docs/jekyll
  • Loading branch information
gawaooooo authored Jul 10, 2024
2 parents 91a219f + 72c3bad commit c0761c8
Show file tree
Hide file tree
Showing 18 changed files with 231 additions and 38 deletions.
69 changes: 69 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# OS detection
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SED_INPLACE := sed -i ''
else
SED_INPLACE := sed -i
endif

DOCS_DIR := ./docs
ACTIONS_DIR := ./composite
ACTDOCS_IMAGE := ghcr.io/tmknom/actdocs

# 処理対象のファイルリスト
ACTION_FILES := $(wildcard $(ACTIONS_DIR)/*/action.yml)
DOC_FILES := $(patsubst $(ACTIONS_DIR)/%/action.yml,$(DOCS_DIR)/%.md,$(ACTION_FILES))

.PHONY: docs
docs: create_docs_dir generate_docs remove_pre_tags ## generate docs for all actions

.PHONY: create_docs_dir
create_docs_dir:
mkdir -p $(DOCS_DIR)

.PHONY: generate_docs
generate_docs: create_docs_dir
@echo "Generating all docs"
@for action in $(ACTION_FILES); do \
output="$(DOCS_DIR)/$$(basename $$(dirname $$action)).md"; \
echo "Generating docs for $$action"; \
docker run --rm -v "$$(pwd):/work" -w "/work" \
$(ACTDOCS_IMAGE) inject --sort --omit --file=$$output $$action; \
done

.PHONY: remove_pre_tags
remove_pre_tags:
@echo "Removing <pre> tags"
@for file in $(DOC_FILES); do \
$(SED_INPLACE) 's/<pre>//g; s/<\/pre>//g' $$file; \
done

.PHONY: list
list: ## List all action files and their corresponding doc files
@echo "Action files:"
@echo $(ACTION_FILES) | tr ' ' '\n'
@echo "\nDoc files:"
@echo $(DOC_FILES) | tr ' ' '\n'

.PHONY: doc
doc: create_docs_dir generate_single_doc remove_single_pre_tags ## Generate doc for a specific action. Usage: make doc ACTION=<action-name>
@echo "Document generation and conversion complete for $(ACTION)"

.PHONY: generate_single_doc
generate_single_doc:
@if [ -z "$(ACTION)" ]; then \
echo "Error: ACTION is not set. Usage: make doc ACTION=<action-name>"; \
exit 1; \
fi
@if [ ! -f "$(ACTIONS_DIR)/$(ACTION)/action.yml" ]; then \
echo "Error: action.yml not found for $(ACTION)"; \
exit 1; \
fi
@echo "Generating doc for $(ACTION)"
@docker run --rm -v "$$(pwd):/work" -w "/work" \
$(ACTDOCS_IMAGE) inject --sort --omit --file=$(DOCS_DIR)/$(ACTION).md $(ACTIONS_DIR)/$(ACTION)/action.yml

.PHONY: remove_single_pre_tags
remove_single_pre_tags:
@echo "Removing <pre> tags for $(ACTION)"
@$(SED_INPLACE) 's/<pre>//g; s/<\/pre>//g' $(DOCS_DIR)/$(ACTION).md
16 changes: 8 additions & 8 deletions composite/aws-s3-deploy-conditionally/action.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: AWS S3 Deploy Conditionally
description: |
This action deploys files to an AWS S3 bucket conditionally.
It uses the 'aws-actions/configure-aws-credentials' action to configure AWS credentials.
It uses the `aws-actions/configure-aws-credentials` action to configure AWS credentials.
In the 'aws-role-arn' input, provide the ARN of your AWS Role.
In the `aws-role-arn` input, provide the ARN of your AWS Role.
Ensure to manage sensitive values such as ARN and keys securely, preferably using GitHub Secrets.
To perform deployment, the action executes a sync command to the specified S3 bucket, controlled by the 'enable-aws-deploy' input parameter.
To perform deployment, the action executes a sync command to the specified S3 bucket, controlled by the `enable-aws-deploy` input parameter.
## Usage Example
Expand All @@ -25,16 +25,16 @@ inputs:
description: |
Specify the AWS region where your S3 bucket is located.
This is necessary for the action to correctly interface with the correct regional endpoint of AWS S3.
For example, use 'us-east-1' for the North Virginia region or 'eu-central-1' for the Frankfurt region.
If not specified, the default region 'ap-northeast-1' (Tokyo) is used.
For example, use `us-east-1` for the North Virginia region or `eu-central-1` for the Frankfurt region.
If not specified, the default region `ap-northeast-1` (Tokyo) is used.
required: false
default: "ap-northeast-1"

aws-role-arn:
description: |
Specify the ARN of your AWS Role for this action.
It is recommended to manage the ARN value securely using GitHub Secrets.
Reference the secret in your workflow like 'aws-role-arn: <your-secret-name>'.
Reference the secret in your workflow like `aws-role-arn: <your-secret-name>`.
required: true

environment:
Expand All @@ -44,9 +44,9 @@ inputs:

s3-sync-command:
description: |
Specify the command to be executed after 'aws s3 sync'.
Specify the command to be executed after `aws s3 sync`.
This command should include the local path of the files to be deployed and the target S3 bucket path, as well as any necessary flags.
For example: ./dist s3://your-bucket-name/path --delete --exclude "tmp/*"
For example: `./dist s3://your-bucket-name/path --delete --exclude "tmp/*"`
required: true

enable-aws-deploy:
Expand Down
18 changes: 11 additions & 7 deletions composite/node-setup-and-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,32 +47,35 @@ inputs:
node-version:
description: |
Set the Node.js version for the project.
If unspecified, the version specified in the .nvmrc file will be used if present.
If unspecified, the version specified in the `.nvmrc` file will be used if present.
required: false

node-version-file:
description: |
Set the path to a file containing the Node.js version, like .nvmrc, used for the project.
Set the path to a file containing the Node.js version, like `.nvmrc`, used for the project.
required: false
default: .nvmrc

node-caching:
description: |
Enable caching for Node.js dependencies.
Specify 'npm' to cache npm dependencies, or leave blank to disable caching.
Specify `npm` to cache npm dependencies, or leave blank to disable caching.
required: false
default: npm

npm-registry-url:
description: |
Specify the npm registry URL.
For example, use `https://registry.npmjs.org` for npm's default registry or `https://npm.pkg.github.com` for GitHub Packages.
required: false

npm-scope:
description: |
Specify the scope for npm package operations, which is typically used with private or scoped packages.
You can set this scope to match the owner of the GitHub repository by referring to the GitHub context variable for the repository owner.
This is particularly useful for projects that use GitHub Packages, where the scope is often set to the repository's owner.
required: false

Expand All @@ -86,20 +89,21 @@ inputs:
Specify the Git reference (branch, tag, commit SHA) to checkout.
This input can be set to checkout a branch other than the default GitHub Actions branch.
You can specify this using GitHub context variables to dynamically determine which reference to use based on the current workflow context.
For example, to use the branch that triggered the workflow, you can reference 'github.ref' in your workflow configuration.
The 'github.head_ref' context is particularly useful in pull request workflows, as it refers to the head branch of the pull request which is being merged from.
For example, to use the branch that triggered the workflow, you can reference `github.ref` in your workflow configuration.
The `github.head_ref` context is particularly useful in pull request workflows, as it refers to the head branch of the pull request which is being merged from.
required: false
default: ${{ github.head_ref }}

npm-install-command:
description: |
Choose between 'ci' (for installing stable dependencies) or 'install' for a general installation.
Choose between `ci` (for installing stable dependencies) or `install` for a general installation.
required: false
default: "ci"

npm-install-options:
description: |
Specify additional options for npm install commands, such as '--ignore-scripts' to skip running scripts.
Specify additional options for npm install commands, such as `--ignore-scripts` to skip running scripts.
required: false

create-inputs-summary:
Expand Down
2 changes: 1 addition & 1 deletion composite/npm-bump-and-commit/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ inputs:
version-type:
description: |
npm version コマンドの引数。
'patch', 'minor', 'major'などの release タイプを指定することを想定。
`patch`, `minor`, `major` などの release タイプを指定することを想定。
required: true
checkout-ref:
description: |
Expand Down
2 changes: 1 addition & 1 deletion composite/npm-bump-from-label/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ inputs:
label-name:
description: |
バージョンを更新するラベル名
release/(patch|minor|major) のいずれかを指定します
`release/(patch|minor|major)` のいずれかを指定します
required: true
checkout-ref:
description: |
Expand Down
8 changes: 4 additions & 4 deletions composite/npm-manual-publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ inputs:
version-type:
description: |
npm version コマンドの引数。
'prepatch', 'preminor', 'premajor'などの pre release タイプを指定することを想定。
`prepatch`, `preminor`, `premajor`などの pre release タイプを指定することを想定。
required: true
publish-tag:
description: |
npm publish コマンドの --tag オプション。
'latest', 'beta', 'alpha', 'next'などがあります。
開発中のバージョンをテスト目的で公開する場合は'next'タグが適しています。
npm publish コマンドの `--tag` オプション。
`latest`, `beta`, `alpha`, `next`などがあります。
開発中のバージョンをテスト目的で公開する場合は`next`タグが適しています。
required: true
github-token:
description: |
Expand Down
4 changes: 2 additions & 2 deletions composite/npm-version-tag-push/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ description: |
inputs:
package-json-path:
description: Path to the package.json file.
description: Path to the `package.json` file.
required: false
default: "package.json"
outputs:
tag:
description: The created Git tag.
description: The created Git tag
value: ${{ steps.tag_version.outputs.tag }}

runs:
Expand Down
6 changes: 4 additions & 2 deletions composite/setup-deployment-config/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ inputs:
build-environments:
description: |
Sets environment variables for the build process.
Provide a string of key-value pairs separated by spaces, e.g., 'BASE_URL="http://example.com" SERVICE="app"'.
Provide a string of key-value pairs separated by spaces, e.g., `BASE_URL="http://example.com" SERVICE="app"`.
required: false
default: ""

s3-sync-command:
description: |
Specifies the command to sync files to an S3 bucket.
Format it as a full command line string, e.g., './dist s3://my-bucket --delete'.
Format it as a full command line string, e.g., `./dist s3://my-bucket --delete`.
required: true

outputs:
Expand Down
3 changes: 2 additions & 1 deletion composite/setup-environment-variables/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ inputs:
Required input to dynamically set the environment variables for your workflow.
Input these as a space-separated string of key-value pairs, where each pair is enclosed in quotes and keys are linked to their values by an equals sign.
This format ensures that the variables can be parsed and set correctly within the workflow.
For example, provide inputs like 'TEST="abc" URL="http://example.com" SERVICE="app"' to seamlessly integrate these variables into your build and deployment processes.
For example, provide inputs like `TEST="abc" URL="http://example.com" SERVICE="app"` to seamlessly integrate these variables into your build and deployment processes.
required: true

runs:
Expand Down
4 changes: 2 additions & 2 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ last_edit_timestamp: true # show or hide edit time - page must have `last_modifi
last_edit_time_format: "%b %e %Y at %I:%M %p" # uses ruby's time format: https://ruby-doc.org/stdlib-2.7.0/libdoc/time/rdoc/Time.html

# Color scheme currently only supports "dark", "light"/nil (default), or a custom scheme that you define
color_scheme: nil
# color_scheme: dark
# color_scheme: nil
color_scheme: dark
# Exclude from processing.
# The following items will not be processed, by default.
# Any item listed under the `exclude:` key here will be automatically added to
Expand Down
24 changes: 21 additions & 3 deletions docs/aws-s3-deploy-conditionally.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
---
title: aws-s3-deploy-conditionally
layout: default
---

# aws-s3-deploy-conditionally
{: .no_toc }

## Table of contents
{: .no_toc .text-delta }

1. TOC
{:toc}

---

[Link button](https://just-the-docs.com){: .btn }

{% raw %}

<!-- actdocs start -->

## Description

This action deploys files to an AWS S3 bucket conditionally.
It uses the 'aws-actions/configure-aws-credentials' action to configure AWS credentials.
It uses the `aws-actions/configure-aws-credentials` action to configure AWS credentials.

In the 'aws-role-arn' input, provide the ARN of your AWS Role.
In the `aws-role-arn` input, provide the ARN of your AWS Role.
Ensure to manage sensitive values such as ARN and keys securely, preferably using GitHub Secrets.

To perform deployment, the action executes a sync command to the specified S3 bucket, controlled by the 'enable-aws-deploy' input parameter.
Expand Down Expand Up @@ -42,4 +60,4 @@ steps:

<!-- actdocs end -->


{% endraw %}
5 changes: 3 additions & 2 deletions docs/git-config.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: git-config
layout: default
permalink: /git-config/
---

# git-config
Expand All @@ -15,6 +14,8 @@ permalink: /git-config/

---

{% raw %}

<!-- actdocs start -->

## Description
Expand All @@ -37,4 +38,4 @@ steps:
<!-- actdocs end -->
{% endraw %}
18 changes: 17 additions & 1 deletion docs/github-release-with-summary.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
---
title: github-release-with-summary
layout: default
---

# github-release-with-summary
{: .no_toc }

## Table of contents
{: .no_toc .text-delta }

1. TOC
{:toc}

---

{% raw %}

<!-- actdocs start -->

Expand Down Expand Up @@ -27,4 +43,4 @@ steps:

<!-- actdocs end -->


{% endraw %}
18 changes: 18 additions & 0 deletions docs/inputs-summary.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
---
title: inputs-summary
layout: default
---

# inputs-summary
{: .no_toc }

## Table of contents
{: .no_toc .text-delta }

1. TOC
{:toc}

---

{% raw %}

<!-- actdocs start -->

Expand Down Expand Up @@ -27,6 +43,8 @@ This serialization method ensures that the JSON format is correctly handled and

<!-- actdocs end -->

{% endraw %}

## 参考

- [GitHub Actions Workflow 作成 Tips > Job Summaries の活用](https://engineers.ntt.com/entry/2022/12/21/095303)
Loading

0 comments on commit c0761c8

Please sign in to comment.