GitHub Action
Release GitHub Actions
Read this in other languages: English, 日本語.
This is a GitHub Actions
that automates the release of GitHub Actions
.
Once you create a new tag, this action will automatically
- Run build
- Create branch for release
- Change tags to release branch
- If there is release which has same tag name and has been published, re-publish it (Because if the tag is changed, the release will be in a draft state).
Details
- Before publish release
- Publish release (Create tag)
- Running
GitHub Actions
- After running
GitHub Actions
- Setup workflow
e.g..github/workflows/release.yml
# on: push on: create name: Release jobs: release: name: Release GitHub Actions runs-on: ubuntu-latest steps: - name: Release GitHub Actions uses: technote-space/release-github-actions@v3 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # TEST_TAG_PREFIX: test/ # CLEAN_TEST_TAG: true
Build command.
default: ''
More details of execute command
Files or directories to clean before release (Comma separated).
default: .[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,*.yml,*.yaml
Absolute path and ..
are not permitted to use.
More details of execute command
Package manager to use to install dependencies.
If there is yarn.lock
or package-lock.json
, the action automatically determines the package manager to use, but this option can be used to specify it explicitly.
(npm
or yarn
)
default: ''
Commit message.
default: 'feat: Build for release'
Commit name.
default: 'github-actions[bot]'
Commit email.
default: '41898282+github-actions[bot]@users.noreply.github.com'
Branch name for GitHub Actions
release.
default: 'gh-actions'
Command for search build command.
default: ''
e.g. compile
If this option is not provided, build
, production
, prod
and package
are used.
Whether to create major version tag (e.g. v1).
default: true
Detail of tags
Whether to create minor version tag (e.g. v1.2).
default: true
Detail of tags
Whether to create patch version tag (e.g. v1.2.3).
default: true
Detail of tags
Limit fetching to the specified number of commits from the tip of each remote branch history.
default: 3
Prefix for test tag.
default: ''
e.g. 'test/'
Whether to clean test tag.
default: 'false'
e.g. 'true'
Prefix to add when leaving the original tag.
default: ''
e.g. 'original/'
- If package.json includes
build
,production
,prod
orpackage
in scripts, the command is used for build. (You can change this with BUILD_COMMAND_TARGET) - If command does not have install command like
npm run install
oryarn install
, install commands are added.
so if BUILD_COMMAND
is not provided and package.json has build
script,
the following commands are executed for build.
yarn install
yarn build
yarn install --production
To execute GitHub Actions
, src files used for build
, test files
, test settings
, etc. are not required.
And GitHub Actions
is downloaded every time when it is used, so fewer files are better.
CLEAN_TARGETS
option is used for this purpose.
default: .[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,*.yml,*.yaml
rm -rdf .[!.]*
rm -rdf *.js
rm -rdf *.ts
rm -rdf *.json
rm -rdf *.lock
rm -rdf *.yml
rm -rdf *.yaml
rm -rdf __tests__ src
(action.yml is not subject to deletion.)
The default setting assumes the use of Action template for TypeScript
or Action template for JavaScript
.
https://github.com/actions/typescript-action
https://github.com/actions/javascript-action
You can see an example of GitHub Actions
with unnecessary files deleted below.
https://github.com/technote-space/release-github-actions/tree/gh-actions
eventName: action | condition |
---|---|
push: * | condition |
release: published | condition |
release: rerequested | condition |
create: * | condition |
- tags
- semantic versioning tag (e.g.
v1.2.3
) - test tag (e.g.
test/v1.2.3
)
- semantic versioning tag (e.g.
Releasing GitHub Actions
needs all build files and dependencies like node_modules
, but are not usually committed.
So if you want to release GitHub Actions
, you have to do following steps.
- Develop locally on the branch for develop
- Build for release
- Commit all source code including dependencies like
node_modules
to branch for release - Add tags (consider major, minor and patch versions)
- Push to GitHub
- Publish release
It is very troublesome to do this steps for every release.
If you use this GitHub Actions
, the steps to do are simpler.
- Develop locally on the branch for develop
- Publish release (Create tag)
- Wait for the automated steps to finish
- Build for release
- Commit all source code including dependencies like
node_modules
to branch for release - Add tags (consider major, minor and patch versions)
- Push to GitHub
Tag name format must be Semantic Versioning.
The following tags will be created.
- tag name
- major tag name (generated by tag name)
- e.g.
v1
- e.g.
- minor tag name (generated by tag name)
- e.g.
v1.2
- e.g.
- patch tag name (generated by tag name)
- e.g.
v1.2.3
- e.g.