-
-
Notifications
You must be signed in to change notification settings - Fork 0
180 lines (171 loc) · 6.09 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: CI
on:
pull_request:
push:
branches:
- '*'
tags:
- '*'
workflow_dispatch:
jobs:
lint-and-test:
name: Lint and Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org/'
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Code test
run: npm run test
release:
name: Release
env:
DIST_ARCHIVE_NAME: ${{ github.event.repository.name }}-dist
runs-on: ubuntu-latest
needs: [lint-and-test]
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org/'
cache: 'npm'
- name: Install dependencies
run: |
npm install
npm run pkg
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
- name: Build changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v2.9.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
configuration: '.github/config/changelog_configuration.json'
ignorePreReleases: 'false'
- name: Archive Release
uses: papeloto/action-zip@v1
with:
files: build/ READEME.md package.json LICENSE
recursive: false
dest: ${{ env.DIST_ARCHIVE_NAME }}-${{ steps.get_version.outputs.VERSION }}.zip
- name: Create Release
uses: softprops/action-gh-release@v1
with:
body: ${{steps.build_changelog.outputs.changelog}}
files: |
${{ env.DIST_ARCHIVE_NAME }}-${{ steps.get_version.outputs.VERSION }}
release/**/*
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
publish-npm:
name: Publish NPM
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 14
registry-url: 'https://registry.npmjs.org/'
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Code test
run: npm run test
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
- name: Publish to NPM
id: publish
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./package.json
tag: latest
registry: https://registry.npmjs.org/
access: public
check-version: true
- if: steps.publish.outputs.type != 'none'
run: |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}"
- name: Push Publish Message
uses: funnyzak/pushoo-action@main
with:
platforms: ifttt,wecombot,bark
tokens: ${{ secrets.PUSH_TOKEN }}
content: |
# ${{github.repository}}:${{ steps.publish.outputs.version }} Npm Publish
## Npm Pakcge Link: https://www.npmjs.com/package/${{github.event.repository.name}}
options: '{"bark": { "url": "https://www.npmjs.com/package/${{github.event.repository.name}}" }}'
debug: false
push-release-message:
name: Push Release Message
runs-on: ubuntu-latest
needs: [release]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Push Release Message
uses: funnyzak/pushoo-action@main
with:
platforms: ifttt,wecombot,bark
tokens: ${{ secrets.PUSH_TOKEN }}
content: |
# ${{ github.event.repository.name }} Released
## trigger: ${{ github.event_name }} at ${{ github.event.head_commit.timestamp }}
## commit message: ${{ github.event.head_commit.message }}
## commit url: ${{ github.event.head_commit.url }}
## commit author: ${{ github.event.head_commit.author.name }}
## commit email: ${{ github.event.head_commit.author.email }}
## commit id: ${{ github.event.head_commit.id }}
title: |
${{ github.repository }} ${{ github.event_name }} Message
options: '{"bark": { "url": "https://github.com/${{github.repository}}" }}'
debug: false
# Homebrew:
# name: Publish Homebrew
# runs-on: ubuntu-latest
# needs: [Release]
# if: startsWith(github.ref, 'refs/tags/')
# steps:
# -
# name: Get the version
# id: get_version
# run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
# -
# name: Publish Homebrew
# uses: Justintime50/homebrew-releaser@v1
# with:
# commit_owner: funnyzak
# commit_email: silenceace@gmail.com
# homebrew_owner: funnyzak
# homebrew_tap: homebrew-tap
# formula_folder: Formula
# github_token: ${{ secrets.github_token }}
# depends_on: |
# "node@16"
# install: 'bin.install "release/${{ github.event.repository.name }}-macos" => "pushoo"'
# test: 'bin/pushoo --version'
# update_readme_table: true
# target_darwin_amd64: https://github.com/${{github.repository}}/releases/download/${{ steps.get_version.outputs.VERSION }}/${{ github.event.repository.name }}-macos
# target_linux_amd64: https://github.com/${{github.repository}}/releases/download/${{ steps.get_version.outputs.VERSION }}/${{ github.event.repository.name }}-linux