Skip to content

Commit

Permalink
fix: Use onetime workdir name (#109)
Browse files Browse the repository at this point in the history
* chore: Allow to release from not master

* chore(release): 3.0.4-0
* chore(release): 3.0.4-1
  • Loading branch information
peaceiris committed Feb 19, 2020
1 parent 195ab80 commit 2f5ccc9
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 13 deletions.
60 changes: 60 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,66 @@

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-1](https://github.com/peaceiris/actions-gh-pages/compare/v3.0.4-0...v3.0.4-1) (2020-02-19)


### deps

* bump @types/node from 13.7.1 to 13.7.2 (#110) ([591c4bd](https://github.com/peaceiris/actions-gh-pages/commit/591c4bdf2ee1c6aa5f1958c4553902feac06dcfe)), closes [#110](https://github.com/peaceiris/actions-gh-pages/issues/110)
* Rollback @types/node 13 to 12 (#111) ([195ab80](https://github.com/peaceiris/actions-gh-pages/commit/195ab8005d4af142c40fd8e53a59783b697d75d9)), closes [#111](https://github.com/peaceiris/actions-gh-pages/issues/111)

### fix

* Add await ([0031179](https://github.com/peaceiris/actions-gh-pages/commit/00311793aa104bf99501373756461475b6752f16))
* convert to string ([cbe4d56](https://github.com/peaceiris/actions-gh-pages/commit/cbe4d56fb8bd50d63919f783483f74c694a3dd9b))
* use onetime workdir name ([0d912a1](https://github.com/peaceiris/actions-gh-pages/commit/0d912a1314ce9d77f29bc0c1fada559223dd5563))

### refactor

* Add info message ([8e6c12a](https://github.com/peaceiris/actions-gh-pages/commit/8e6c12a2b5f973c8736f831398d0fe7c980f1431))



## [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)


Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "actions-github-pages",
"version": "3.0.3",
"version": "3.0.4-1",
"description": "GitHub Actions for GitHub Pages",
"main": "lib/index.js",
"engines": {
Expand Down
36 changes: 28 additions & 8 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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}"
8 changes: 6 additions & 2 deletions src/git-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ export async function copyAssets(
return;
}

export async function setRepo(inps: Inputs, remoteURL: string): Promise<void> {
const workDir = path.join(getHomeDir(), 'actions_github_pages');
export async function setRepo(
inps: Inputs,
remoteURL: string,
unixTime: string
): Promise<void> {
const workDir = path.join(getHomeDir(), `actions_github_pages_${unixTime}`);
const publishDir = path.join(
`${process.env.GITHUB_WORKSPACE}`,
inps.PublishDir
Expand Down
5 changes: 4 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export async function run(): Promise<void> {
const remoteURL = await setTokens(inps);
core.debug(`[INFO] remoteURL: ${remoteURL}`);

await git.setRepo(inps, remoteURL);
const date = new Date();
const unixTime = date.getTime();
await git.setRepo(inps, remoteURL, `${unixTime}`);

try {
await exec.exec('git', ['remote', 'rm', 'origin']);
Expand All @@ -31,6 +33,7 @@ export async function run(): Promise<void> {
);
await git.push(inps.PublishBranch, inps.ForceOrphan);
await git.pushTag(inps.TagName, inps.TagMessage);

core.info('[INFO] Action successfully completed');

return;
Expand Down

0 comments on commit 2f5ccc9

Please sign in to comment.