Skip to content

Commit

Permalink
chore(release): v1.1.0-0 (#26)
Browse files Browse the repository at this point in the history
* feat: 🎸 abolish branch execution

BREAKING CHANGE: Abolish branch execution

* ci: remove husky pre-commit hook for ncc

* ci: Add ncc build assets

* ci: Add commit step to add build assets

* ci: Fix action test job

* ci: Dump

* ci: Fix action test job

* ci: Fix action test job

* ci: Fix action test job

* ci: Revert action test job

* chore: Add docker image for testing

* test: Add Integration testing

* ci: Add matrix to test job

* docs: Add Maintainer Notes

* docs: Fix heading

* ci: Split test workflow

* chore: Remove .gitattributes

* ci: Fix cache step

* ci: Add RELEASE_TYPE_LIST

* ci: Add -r option to fix SC2162

* ci: Add build assets steps

* ci: Fix CHANGELOG diff

* ci: Add build assets

* chore(release): 1.1.0-0

* ci: Remove build assets

Co-authored-by: Shohei Ueda <[email protected]>
  • Loading branch information
github-actions[bot] and peaceiris committed Dec 31, 2019
1 parent bbf6904 commit a30a7c8
Show file tree
Hide file tree
Showing 14 changed files with 237 additions and 5,389 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.*

!.eslintrc.json
!.prettierrc.json

coverage
node_modules
3 changes: 0 additions & 3 deletions .gitattributes

This file was deleted.

31 changes: 20 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,40 @@ jobs:
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"

- name: Cache
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci

- name: Prepare release
if: github.event.before == '0000000000000000000000000000000000000000'
- name: Setup Git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Commit build assets
run: |
mkdir ./lib
npm run build
git add ./lib/index.js
git commit -m "ci: Add build assets"
- name: Prepare release
run: |
echo "::set-env name=CHANGELOG_SHA::$(git rev-parse HEAD)"
git fetch origin
npm run release -- --release-as "${RELEASE_TYPE}" --preset eslint
git push origin "${BRANCH_NAME}"
export TAG_NAME="v$(jq -r '.version' ./package.json)"
git push origin "${TAG_NAME}"
echo "::set-env name=TAG_NAME::${TAG_NAME}"
- name: Remove build assets
run: |
git rm ./lib/index.js
rm -rf ./lib
git commit -m "ci: Remove build assets"
git push origin "${BRANCH_NAME}"
- name: Install hub
run: |
HUB_VERSION="2.13.0"
Expand All @@ -75,7 +84,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git diff HEAD^ ./CHANGELOG.md | grep "^+" | sed -e '1d' | sed -e 's/^+//g' > ./release_notes.md
git diff "${CHANGELOG_SHA}" HEAD ./CHANGELOG.md | grep "^+" | sed -e '1d' | sed -e 's/^+//g' > ./release_notes.md
sed -i "1iRelease ${TAG_NAME}\n" ./release_notes.md
hub release create \
--draft \
Expand Down
78 changes: 49 additions & 29 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,51 @@ on:
- master

jobs:
test:
code-health:
runs-on: ubuntu-18.04
steps:

- uses: actions/checkout@v2

- name: Read .nvmrc
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
id: nvm

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'

- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache npm
uses: actions/cache@v1
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci

- run: npm run format:check

- run: npm run lint

- run: npm run build


test:
runs-on: ${{ matrix.os }}
needs: code-health
strategy:
matrix:
os: ['ubuntu-18.04', 'macos-latest', 'windows-latest']
steps:

- uses: actions/checkout@v2

- name: Read .nvmrc
Expand All @@ -29,46 +70,25 @@ jobs:
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'

- name: Cache
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache npm
uses: actions/cache@v1
with:
path: ~/.npm
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci

- run: npm run format:check

- run: npm run lint

- run: npm test

- name: Check ncc
run: |
npm run build
test -z "$(git status --short)"
- name: Upload test coverage
uses: actions/upload-artifact@v1
with:
name: coverage
path: coverage


test-prod:
runs-on: ${{ matrix.os }}
needs: test
strategy:
matrix:
os: ['ubuntu-18.04', 'macos-latest', 'windows-latest']
mdbook-version: ['latest', '0.3.4']

steps:
- uses: actions/checkout@v2

- name: Test action
uses: ./
with:
mdbook-version: ${{ matrix.mdbook-version }}
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

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.

# 1.1.0-0 (2019-12-31)


### ci

* Add build assets ([ad4ae66](https://github.com/peaceiris/actions-mdbook/commit/ad4ae6651ef8065b334183227282577711b4209f))
* Fix CHANGELOG diff ([e30d78d](https://github.com/peaceiris/actions-mdbook/commit/e30d78d4734bbfbc4579dbbefa449edd4925b941))



## 1.0.3 (2019-12-29)


Expand Down
26 changes: 22 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,21 @@ Linux, macOS, and Windows are supported.
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->


- [Getting started](#getting-started)
- [Getting Started](#getting-started)
- [⭐️ Create your workflow](#%EF%B8%8F-create-your-workflow)
- [Options](#options)
- [⭐️ Use the latest version of mdBook](#%EF%B8%8F-use-the-latest-version-of-mdbook)
- [Tips](#tips)
- [⭐️ Read mdBook version from file](#%EF%B8%8F-read-mdbook-version-from-file)
- [License](#license)
- [About the author](#about-the-author)
- [About Maintainer](#about-maintainer)
- [Maintainer Notes](#maintainer-notes)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->



## Getting started
## Getting Started

### ⭐️ Create your workflow

Expand Down Expand Up @@ -176,12 +177,29 @@ The alpine base mdBook Docker image is provided on the following repository.



## About the author
## About Maintainer

- [peaceiris's homepage](https://peaceiris.com/)



## Maintainer Notes

Run `npm` and `git commit` commands on a container.

```sh
# On host
npm run docker:build
npm run docker:run
# On Container
npm test
git add ./__tests__
git commit -m "test: Add something"
```



<div align="right">
<a href="#table-of-contents">Back to TOC ☝️</a>
</div>
11 changes: 11 additions & 0 deletions __tests__/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:12-slim

WORKDIR /repo

RUN apt-get update && \
apt-get -y install --no-install-recommends \
git \
bash && \
rm -rf /var/lib/apt/lists/*

CMD [ "bash" ]
27 changes: 27 additions & 0 deletions __tests__/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import * as main from '../src/main';

jest.setTimeout(20000);

beforeEach(() => {
jest.resetModules();
});

afterEach(() => {
delete process.env['INPUT_MDBOOK-VERSION'];
});

describe('run()', () => {
test('Integration testing (custom version)', async () => {
const testVersion: string = '0.3.4';
process.env['INPUT_MDBOOK-VERSION'] = testVersion;
const result: main.actionResult = await main.run();
expect(result.output).toMatch(`mdbook v${testVersion}`);
});

test('Integration testing (latest version)', async () => {
const testVersion: string = 'latest';
process.env['INPUT_MDBOOK-VERSION'] = testVersion;
const result: main.actionResult = await main.run();
expect(result.output).toMatch(/mdbook v/);
});
});
Loading

0 comments on commit a30a7c8

Please sign in to comment.