Skip to content

Commit 3b8f66a

Browse files
Merge pull request #13 from technote-space/release/v1.0.1
Release/v1.0.1
2 parents 73b855a + a270e65 commit 3b8f66a

File tree

6 files changed

+55
-4
lines changed

6 files changed

+55
-4
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Release GitHub Actions
22-
uses: technote-space/[email protected].0
22+
uses: technote-space/[email protected].1
2323
with:
2424
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
2525
```
@@ -43,13 +43,15 @@ Build command.
4343
default: `''`
4444
- If package.json includes build or production or prod in scripts, the command is used for build.
4545
- If command does not have install command like `npm run install` or `yarn install`, install commands are added.
46+
- If command is not provided, `rm -rdf .github` command is added.
4647

4748
so if `BUILD_COMMAND` is not provided and package.json has `build` script,
4849
the following commands are executed.
4950
```shell
5051
yarn install
5152
yarn build
5253
yarn install --production
54+
rm -rdf .github
5355
```
5456

5557
### COMMIT_MESSAGE

__tests__/utils/misc.test.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,15 @@ describe('getBuildCommands', () => {
177177
});
178178

179179
it('should get build commands 2', () => {
180+
expect(getBuildCommands(path.resolve(__dirname, '..', 'fixtures', 'test4'))).toEqual([
181+
'yarn install',
182+
'yarn build', // build command of package.json
183+
'yarn install --production',
184+
'rm -rdf .github',
185+
]);
186+
});
187+
188+
it('should get build commands 3', () => {
180189
process.env.INPUT_BUILD_COMMAND = 'yarn build';
181190
expect(getBuildCommands(path.resolve(__dirname, '..', 'fixtures', 'test4'))).toEqual([
182191
'yarn install',
@@ -185,15 +194,15 @@ describe('getBuildCommands', () => {
185194
]);
186195
});
187196

188-
it('should get build commands 3', () => {
197+
it('should get build commands 4', () => {
189198
process.env.INPUT_BUILD_COMMAND = 'yarn install && yarn build';
190199
expect(getBuildCommands(path.resolve(__dirname, '..', 'fixtures', 'test4'))).toEqual([
191200
'yarn install',
192201
'yarn build',
193202
]);
194203
});
195204

196-
it('should get build commands 4', () => {
205+
it('should get build commands 5', () => {
197206
process.env.INPUT_BUILD_COMMAND = 'test';
198207
expect(getBuildCommands(path.resolve(__dirname, '..', 'fixtures', 'test1'))).toEqual([
199208
'yarn install',
@@ -202,9 +211,10 @@ describe('getBuildCommands', () => {
202211
]);
203212
});
204213

205-
it('should get build commands 5', () => {
214+
it('should get build commands 6', () => {
206215
expect(getBuildCommands(path.resolve(__dirname, '..', 'fixtures', 'test1'))).toEqual([
207216
'yarn install --production',
217+
'rm -rdf .github',
208218
]);
209219
});
210220
});

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"@actions/core": "^1.0.0",
2323
"@actions/github": "^1.0.0",
2424
"js-yaml": "^3.13.1",
25+
"rmdir": "^1.2.0",
2526
"signale": "^1.4.0"
2627
},
2728
"devDependencies": {

src/utils/command.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import fs from 'fs';
22
import path from 'path';
3+
import rmdir from 'rmdir';
34
import signale from 'signale';
45
import {exec} from 'child_process';
56
import {Context} from '@actions/github/lib/context';
@@ -11,6 +12,7 @@ export const deploy = async (branch: string, context: Context) => {
1112
const pushDir = path.resolve(workDir, 'push');
1213
signale.info(`Deploying branch %s to %s`, branch, getRepository(context));
1314

15+
rmdir(workDir);
1416
fs.mkdirSync(pushDir, {recursive: true});
1517
await prepareFiles(buildDir, pushDir, context);
1618
await cloneForBranch(pushDir, branch, context);

src/utils/misc.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ export const getBuildCommands = (dir: string): string[] => {
3636
commands.push('yarn install --production');
3737
}
3838

39+
if ('' === command) {
40+
commands.push('rm -rdf .github');
41+
}
42+
3943
return commands;
4044
};
4145

yarn.lock

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,6 +1745,11 @@ is-wsl@^1.1.0:
17451745
resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d"
17461746
integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=
17471747

1748+
is@~0.2.6:
1749+
version "0.2.7"
1750+
resolved "https://registry.yarnpkg.com/is/-/is-0.2.7.tgz#3b34a2c48f359972f35042849193ae7264b63562"
1751+
integrity sha1-OzSixI81mXLzUEKEkZOucmS2NWI=
1752+
17481753
[email protected], isarray@~1.0.0:
17491754
version "1.0.0"
17501755
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
@@ -2633,6 +2638,21 @@ node-pre-gyp@^0.12.0:
26332638
semver "^5.3.0"
26342639
tar "^4"
26352640

2641+
2642+
version "1.0.8"
2643+
resolved "https://registry.yarnpkg.com/node.extend/-/node.extend-1.0.8.tgz#bab04379f7383f4587990c9df07b6a7f65db772b"
2644+
integrity sha1-urBDefc4P0WHmQyd8Htqf2Xbdys=
2645+
dependencies:
2646+
is "~0.2.6"
2647+
object-keys "~0.4.0"
2648+
2649+
2650+
version "1.2.3"
2651+
resolved "https://registry.yarnpkg.com/node.flow/-/node.flow-1.2.3.tgz#e1c44a82aeca8d78b458a77fb3dc642f2eba2649"
2652+
integrity sha1-4cRKgq7KjXi0WKd/s9xkLy66Jkk=
2653+
dependencies:
2654+
node.extend "1.0.8"
2655+
26362656
nopt@^4.0.1:
26372657
version "4.0.1"
26382658
resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d"
@@ -2722,6 +2742,11 @@ object-keys@^1.0.12:
27222742
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e"
27232743
integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==
27242744

2745+
object-keys@~0.4.0:
2746+
version "0.4.0"
2747+
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-0.4.0.tgz#28a6aae7428dd2c3a92f3d95f21335dd204e0336"
2748+
integrity sha1-KKaq50KN0sOpLz2V8hM13SBOAzY=
2749+
27252750
object-visit@^1.0.0:
27262751
version "1.0.1"
27272752
resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb"
@@ -3188,6 +3213,13 @@ rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.3:
31883213
dependencies:
31893214
glob "^7.1.3"
31903215

3216+
rmdir@^1.2.0:
3217+
version "1.2.0"
3218+
resolved "https://registry.yarnpkg.com/rmdir/-/rmdir-1.2.0.tgz#4fe0357cb06168c258e73e968093dc4e8a0f3253"
3219+
integrity sha1-T+A1fLBhaMJY5z6WgJPcTooPMlM=
3220+
dependencies:
3221+
node.flow "1.2.3"
3222+
31913223
rsvp@^4.8.4:
31923224
version "4.8.5"
31933225
resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734"

0 commit comments

Comments
 (0)