Skip to content

Commit

Permalink
ci: add release action
Browse files Browse the repository at this point in the history
  • Loading branch information
zthxxx committed Jun 27, 2020
1 parent 098ef33 commit 8ddf48e
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 19 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- name: Checkout
uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: install
node-version: 13.x

- name: Install
run: |
npm ci
- name: build
- name: Build
run: |
npm run build
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: release bundle zip

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 13.x

- name: Install
run: |
npm ci
- name: Build
id: build
run: |
npm run build
- name: Changelog
id: changelog
uses: scottbrenner/generate-changelog-action@master
env:
REPO: ${{ github.repository }}

- name: Create Release
id: create-release
uses: actions/create-release@v1
env:
# This token is provided by Actions, you do not need to create your own token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: false

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
# This token is provided by Actions, you do not need to create your own token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_name: ${{ steps.build.outputs.bundle-file }}
asset_path: ${{ steps.build.outputs.bundle-path }}
asset_content_type: application/zip
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ node_modules
/build

*.zip
*.log
17 changes: 17 additions & 0 deletions .versionrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"header": "# Changelog\n",
"types": [
{"type": "feat", "section": "feat"},
{"type": "fix", "section": "fix"},
{"type": "perf", "section": "perf"},
{"type": "revert", "section": "revert"},
{"type": "docs", "section": "docs"},
{"type": "style", "section": "style"},
{"type": "chore", "section": "chore"},
{"type": "refactor", "section": "refactor"},
{"type": "test", "section": "test"},
{"type": "build", "section": "build"},
{"type": "ci", "section": "ci"}
],
"commitUrlFormat": "{{host}}/{{owner}}/{{repository}}/commit/{{hash}}(type:{{type}})"
}
4 changes: 0 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Changelog

`kugimiya-rainbow-fart`

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.0.0](https://github.com/zthxxx/kugimiya-rainbow-fart/compare/v0.0.1...v1.0.0) (2020-06-25)

- update all of voices
Expand Down
13 changes: 9 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import yaml from 'js-yaml'
import gulp from 'gulp'
import zip from 'gulp-zip'
import rimraf from 'rimraf'
import { setOutput } from '@actions/core'
import rawManifest from './manifest.json'
import pkg from './package.json'

Expand Down Expand Up @@ -49,12 +50,16 @@ gulp.task('build-manifest', (done) => {
})


gulp.task('bundle', () => (
gulp.src('build/**/*')
.pipe(zip(`${name}-${version}.zip`))
gulp.task('bundle', async () => {
const bundleName = `${name}-${version}.zip`

await gulp.src('build/**/*')
.pipe(zip(bundleName))
.pipe(gulp.dest('dist'))
))

setOutput('bundle-file', bundleName)
setOutput('bundle-path', `./dist/${bundleName}`)
})

gulp.task('default', gulp.series(
'clean',
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

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

20 changes: 14 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
"description": "Kugimiya voice for vscode-rainbow-fart",
"main": "manifest.json",
"scripts": {
"build": "node -r esm node_modules/.bin/gulp",
"changelog": "standard-version"
"build": "npm run gulp",
"clean": "npm run gulp clean",
"gulp": "node -r esm node_modules/.bin/gulp",
"bump:patch": "npm version patch --no-git-tag-version",
"release": "standard-version"
},
"author": "zthxxx",
"repository": "zthxxx/kugimiya-rainbow-fart",
Expand All @@ -25,6 +28,7 @@
},
"homepage": "https://github.com/zthxxx/kugimiya-rainbow-fart",
"devDependencies": {
"@actions/core": "^1.2.4",
"esm": "^3.2.25",
"gulp": "^4.0.2",
"gulp-zip": "^5.0.2",
Expand All @@ -34,9 +38,13 @@
},
"standard-version": {
"skip": {
"bump": true,
"commit": true,
"tag": true
}
"bump": false,
"commit": false,
"tag": false
},
"bumpFiles": [
"package.json",
"package-lock.json"
]
}
}

0 comments on commit 8ddf48e

Please sign in to comment.