-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (115 loc) · 5.56 KB
/
main.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
name: CI
on: [push, pull_request]
jobs:
Test:
if: github.ref != 'refs/heads/gh-pages' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Debugging
run: echo '${{toJSON(github)}}'
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Commit
uses: actions/checkout@v2
- name: Parsing Package Info
id: packageInfo
run: |
echo "::set-output name=package-name::$(jq -r .name package.json)"
echo "::set-output name=package-version::$(jq -r .version package.json)"
echo "::set-output name=commit-msg::$(git log -1 --pretty=%B)"
- name: Setup Node.js environment
uses: actions/setup-node@v2.1.1
with:
# Set always-auth in npmrc
always-auth: false
# Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0
node-version: 12.x
# Set this option if you want the action to check for the latest available version that satisfies the version spec
check-latest: true
# Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN
registry-url: false
# Optional scope for authenticating against scoped registries
scope: false
- name: Setup Yarn
run: npm install -g yarn && cd $GITHUB_WORKSPACE
- name: Install Dependencies
run: yarn install
- name: Build and Test
run: cd $GITHUB_WORKSPACE && yarn run clean:all && yarn run build:all
Publish-Docs-And-Package:
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
needs: Test
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Commit
uses: actions/checkout@v2
- name: Parsing Package Info
id: packageInfo
run: |
echo "::set-output name=package-name::$(jq -r .name package.json)"
echo "::set-output name=package-version::$(jq -r .version package.json)"
echo "::set-output name=commit-msg::$(git log -1 --pretty=%B)"
- name: Setup Node.js environment
uses: actions/setup-node@v2.1.1
with:
# Set always-auth in npmrc
always-auth: false
# Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0
node-version: 12.x
# Set this option if you want the action to check for the latest available version that satisfies the version spec
check-latest: true
# Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN
registry-url: false
# Optional scope for authenticating against scoped registries
scope: false
- name: Setup Yarn
run: npm install -g yarn && cd $GITHUB_WORKSPACE
- name: Install Dependencies
run: yarn install
- name: Build
run: cd $GITHUB_WORKSPACE && yarn run clean:all && yarn run build:all-rel
- name: Remove .gitignore from Docs Dir
run: rm docs/HTML/.gitignore
- name: Publish Docs to GH Pages
continue-on-error: true
uses: crazy-max/ghaction-github-pages@v2
with:
target_branch: gh-pages
build_dir: docs/HTML
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: releaseCreate
continue-on-error: true
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# The name of the tag. This should come from the webhook payload, `github.GITHUB_REF` when a user pushes a new tag
tag_name: v${{ steps.packageInfo.outputs.package-version }}
# The name of the release. For example, `Release v1.0.1`
release_name: v${{steps.packageInfo.outputs.package-version}}
# Text describing the contents of the tag.
body: ${{steps.packageInfo.outputs.commit-msg}}
# `true` to create a draft (unpublished) release, `false` to create a published one. Default: `false`
draft: false
# `true` to identify the release as a prerelease. `false` to identify the release as a full release. Default: `false`
prerelease: false
- name: Pack Package
run: cd $GITHUB_WORKSPACE && yarn pack --filename "${{steps.packageInfo.outputs.package-name}}-${{steps.packageInfo.outputs.package-version}}.tgz"
- name: Upload Package to Release
continue-on-error: true
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# The URL for uploading assets to the release
upload_url: ${{steps.releaseCreate.outputs.upload_url}}
# The path to the asset you want to upload
asset_path: ${{github.workspace}}/${{steps.packageInfo.outputs.package-name}}-${{steps.packageInfo.outputs.package-version}}.tgz
asset_name: NPM-Package-${{steps.packageInfo.outputs.package-name}}-${{steps.packageInfo.outputs.package-version}}.tgz
# The content-type of the asset you want to upload. See the supported Media Types here: https://www.iana.org/assignments/media-types/media-types.xhtml for more information
asset_content_type: application/x-compressed-tar