Compare commits

...

6 Commits

Author SHA1 Message Date
peaceiris
b4f10d7ab2 chore(release): 3.0.4-0 2020-02-19 02:00:28 +09:00
peaceiris
1dd24adb25 chore(release): Add build assets 2020-02-19 02:00:27 +09:00
peaceiris
6595e02d68 fix: tag fetching 2020-02-19 02:00:06 +09:00
peaceiris
6fe5c9e762 fix: tag fetching 2020-02-19 01:58:52 +09:00
peaceiris
3c7cd587e4 chore: Allow to release from not master 2020-02-19 01:53:35 +09:00
peaceiris
5ba5849ab2 fix: Add removing workDir at the end 2020-02-19 01:26:00 +09:00
7 changed files with 26942 additions and 15 deletions

View File

@ -2,6 +2,46 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [3.0.4-0](https://github.com/peaceiris/actions-gh-pages/compare/v3.0.3...v3.0.4-0) (2020-02-18)
### chore
* Allow to release from not master ([3c7cd58](https://github.com/peaceiris/actions-gh-pages/commit/3c7cd587e403a76d6725a0e84796cf12a59752f3))
### deps
* bump @types/jest from 25.1.1 to 25.1.2 (#93) ([aec195e](https://github.com/peaceiris/actions-gh-pages/commit/aec195ebb4e984f62f48139a5e24aa85ea31e891)), closes [#93](https://github.com/peaceiris/actions-gh-pages/issues/93)
* bump @types/node from 13.7.0 to 13.7.1 (#99) ([0b00dd2](https://github.com/peaceiris/actions-gh-pages/commit/0b00dd2a9f91c1854f4b1cfe68dc30891ebccc9f)), closes [#99](https://github.com/peaceiris/actions-gh-pages/issues/99)
* bump @typescript-eslint/eslint-plugin from 2.19.0 to 2.19.2 (#97) ([5d5e933](https://github.com/peaceiris/actions-gh-pages/commit/5d5e9338ccbca63f80f5ee66ba9e9eff14bacb68)), closes [#97](https://github.com/peaceiris/actions-gh-pages/issues/97)
* bump @typescript-eslint/eslint-plugin from 2.19.2 to 2.20.0 (#105) ([1c50baa](https://github.com/peaceiris/actions-gh-pages/commit/1c50baa294d259f81459f7a495f8d0d2a50a1b6d)), closes [#105](https://github.com/peaceiris/actions-gh-pages/issues/105)
* bump @typescript-eslint/parser from 2.19.0 to 2.19.2 (#96) ([8b52b41](https://github.com/peaceiris/actions-gh-pages/commit/8b52b41ecb191f50bd5efc9ee2c0266a2d171d14)), closes [#96](https://github.com/peaceiris/actions-gh-pages/issues/96)
* bump @typescript-eslint/parser from 2.19.2 to 2.20.0 (#106) ([73c09c7](https://github.com/peaceiris/actions-gh-pages/commit/73c09c703e63c0b442ffa50624ace10eaa929280)), closes [#106](https://github.com/peaceiris/actions-gh-pages/issues/106)
* bump eslint-plugin-jest from 23.6.0 to 23.7.0 (#95) ([0a1a581](https://github.com/peaceiris/actions-gh-pages/commit/0a1a58196ba5bf48e168475e0ac3898fbd3043e2)), closes [#95](https://github.com/peaceiris/actions-gh-pages/issues/95)
* bump husky from 4.2.1 to 4.2.3 (#102) ([49a6939](https://github.com/peaceiris/actions-gh-pages/commit/49a6939dbb77d7656228cdc3bed6a99d5124a6b2)), closes [#102](https://github.com/peaceiris/actions-gh-pages/issues/102)
* bump node from 12.14.1 to 12.15.0 (#94) ([0e542f9](https://github.com/peaceiris/actions-gh-pages/commit/0e542f9f9231c005e1a6363a33a69fdbde436085)), closes [#94](https://github.com/peaceiris/actions-gh-pages/issues/94)
### docs
* fix ([60c31d2](https://github.com/peaceiris/actions-gh-pages/commit/60c31d23a8a096624a3b9a0955a05ea9941dc140))
* rename author to Maintainer ([4101589](https://github.com/peaceiris/actions-gh-pages/commit/41015898aad0abad9d0760bc576e4748e476d4f9))
* update job name ([752214a](https://github.com/peaceiris/actions-gh-pages/commit/752214aa33756f6e097f908671681a13865a9991))
* update publish_branch for v3 ([a7866b5](https://github.com/peaceiris/actions-gh-pages/commit/a7866b5bd3a121a460c8c39cb1c9d1586db6b231))
* update status of github_token ([1887981](https://github.com/peaceiris/actions-gh-pages/commit/1887981f72e59b54f68febb4fa4786e7e153ef6d))
### fix
* Add removing workDir at the end ([5ba5849](https://github.com/peaceiris/actions-gh-pages/commit/5ba5849ab229d5b6eecc1d13de82e71999961cdc))
* Change final message ([476fa94](https://github.com/peaceiris/actions-gh-pages/commit/476fa94197aea4d3f74e5619ae77ebf966fd5fff))
* tag fetching ([6595e02](https://github.com/peaceiris/actions-gh-pages/commit/6595e02d683d6ca8275d76e2818662da80ac685a))
* tag fetching ([6fe5c9e](https://github.com/peaceiris/actions-gh-pages/commit/6fe5c9e76213b6d5bc542be649cbe0289e947ab6))
### refactor
* fix typo and remove useless function (#107) ([55a68e3](https://github.com/peaceiris/actions-gh-pages/commit/55a68e34ca406d99b5b2a4549d7ade5eeb03d860)), closes [#107](https://github.com/peaceiris/actions-gh-pages/issues/107)
## [3.0.3](https://github.com/peaceiris/actions-gh-pages/compare/v3.0.3-0...v3.0.3) (2020-02-06)

26861
lib/index.js Normal file

File diff suppressed because it is too large Load Diff

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "actions-github-pages",
"version": "3.0.3",
"version": "3.0.4-0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "actions-github-pages",
"version": "3.0.3",
"version": "3.0.4-0",
"description": "GitHub Actions for GitHub Pages",
"main": "lib/index.js",
"engines": {

View File

@ -3,12 +3,23 @@
# fail on unset variables and command errors
set -eu -o pipefail # -x: is for debugging
if [ "$(git branch --show-current)" != "master" ]; then
echo "$0: Current branch is not master" 1>&2
exit 1
CURRENT_BRANCH="$(git branch --show-current)"
if [ "${CURRENT_BRANCH}" != "master" ]; then
echo "$0: Current branch ${CURRENT_BRANCH} is not master, continue? (y/n)"
read -r res
if [ "${res}" = "n" ]; then
echo "$0: Stop script"
exit 0
fi
fi
PRERELEASE_TYPE_LIST="prerelease prepatch preminor premajor"
if [ "${CURRENT_BRANCH}" != "master" ]; then
RELEASE_TYPE_LIST="${PRERELEASE_TYPE_LIST}"
else
RELEASE_TYPE_LIST="${PRERELEASE_TYPE_LIST} patch minor major"
fi
RELEASE_TYPE_LIST="prerelease prepatch patch preminor minor major premajor"
if command -v fzf; then
RELEASE_TYPE=$(echo "${RELEASE_TYPE_LIST}" | tr ' ' '\n' | fzf --layout=reverse)
else
@ -26,9 +37,13 @@ if [ "${res}" = "n" ]; then
fi
git fetch origin
git pull origin master
git tag -d v3 || true
git pull origin --tags
if [ "${CURRENT_BRANCH}" != "master" ]; then
git pull origin "${CURRENT_BRANCH}"
else
git pull origin master
git tag -d v3 || true
git pull origin --tags
fi
npm ci
@ -43,6 +58,11 @@ git rm ./lib/index.js
rm -rf ./lib
git commit -m "chore(release): Remove build assets [skip ci]"
if [ "${CURRENT_BRANCH}" != "master" ]; then
git push origin "${CURRENT_BRANCH}"
else
git push origin master
fi
TAG_NAME="v$(jq -r '.version' ./package.json)"
git push origin master
git push origin "${TAG_NAME}"

View File

@ -38,7 +38,10 @@ export async function copyAssets(
return;
}
export async function setRepo(inps: Inputs, remoteURL: string): Promise<void> {
export async function setRepo(
inps: Inputs,
remoteURL: string
): Promise<string> {
const workDir = path.join(getHomeDir(), 'actions_github_pages');
const publishDir = path.join(
`${process.env.GITHUB_WORKSPACE}`,
@ -51,7 +54,7 @@ export async function setRepo(inps: Inputs, remoteURL: string): Promise<void> {
process.chdir(workDir);
await createBranchForce(inps.PublishBranch);
await copyAssets(publishDir, workDir);
return;
return workDir;
}
const result: CmdResult = {
@ -89,7 +92,7 @@ export async function setRepo(inps: Inputs, remoteURL: string): Promise<void> {
}
await copyAssets(publishDir, workDir);
return;
return workDir;
} else {
throw new Error(`Failed to clone remote branch ${inps.PublishBranch}`);
}
@ -102,7 +105,7 @@ export async function setRepo(inps: Inputs, remoteURL: string): Promise<void> {
process.chdir(workDir);
await createBranchForce(inps.PublishBranch);
await copyAssets(publishDir, workDir);
return;
return workDir;
}
}

View File

@ -1,5 +1,6 @@
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as io from '@actions/io';
import {Inputs} from './interfaces';
import {getInputs} from './get-inputs';
import {setTokens} from './set-tokens';
@ -14,7 +15,7 @@ export async function run(): Promise<void> {
const remoteURL = await setTokens(inps);
core.debug(`[INFO] remoteURL: ${remoteURL}`);
await git.setRepo(inps, remoteURL);
const workDir = await git.setRepo(inps, remoteURL);
try {
await exec.exec('git', ['remote', 'rm', 'origin']);
@ -33,6 +34,8 @@ export async function run(): Promise<void> {
await git.pushTag(inps.TagName, inps.TagMessage);
core.info('[INFO] Action successfully completed');
io.rmRF(workDir);
return;
} catch (e) {
throw new Error(e);