-
Notifications
You must be signed in to change notification settings - Fork 3
131 lines (126 loc) · 5.06 KB
/
npm-publish.yml
File metadata and controls
131 lines (126 loc) · 5.06 KB
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
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
name: Publish Github Package
on:
push:
branches: [ master ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# - name: Discord notification with commit
# env:
# DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
# uses: Ilshidur/action-discord@master
# - name: Discord notification to show a test start
# env:
# DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
# uses: Ilshidur/action-discord@master
# with:
# args: '[INFO] Project {{ EVENT_PAYLOAD.repository.full_name }} is being tested for package deployment on Github Packages.'
- uses: actions/setup-node@v1
with:
node-version: 10
- run: npm install
- uses: harmon758/postgresql-action@v1
with:
postgresql version: '9.6'
postgresql db: 'test'
postgresql user: 'postgres'
postgresql password: 'postgres'
- name: Wait / Sleep
uses: jakejarvis/wait-action@v0.1.0
with:
time: '10s'
- name: Collect Docker Logs
uses: jwalton/gh-docker-logs@v1.0.0
- name: Check running containers
run: docker ps -a
- run: POSTGRESQL_HOST=localhost POSTGRESQL_PORT=5432 POSTGRESQL_USER=postgres POSTGRESQL_PASSWORD=postgres POSTGRESQL_DATABASE=test CI=true npm test
# - name: Discord notification for test success
# if: ${{ success() }}
# env:
# DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
# uses: Ilshidur/action-discord@master
# with:
# args: '[SUCCESS] Tests for project {{ EVENT_PAYLOAD.repository.full_name }} executed succesfully. Package deployment on Github Packages will start.'
# - name: Discord notification for test failure
# if: ${{ failure() }}
# env:
# DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
# uses: Ilshidur/action-discord@master
# with:
# args: '[ERROR] Tests for project {{ EVENT_PAYLOAD.repository.full_name }} failed. Check and fix errors, then start deployment again.'
# - name: Discord notification for test cancel
# if: ${{ cancelled() }}
# env:
# DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
# uses: Ilshidur/action-discord@master
# with:
# args: '[WARNING] Tests for project {{ EVENT_PAYLOAD.repository.full_name }} have been cancelled. Deployment progress will stop.'
# - name: Upload node modules artifact
# uses: actions/upload-artifact@v2
# with:
# # Artifact name
# name: node_modules # optional
# # A file, directory or wildcard pattern that describes what to upload
# path: node_modules/
#publish-npm:
#needs: test
#runs-on: ubuntu-latest
#steps:
#- uses: actions/checkout@v2
#- uses: actions/setup-node@v1
#with:
#node-version: 10
#registry-url: https://registry.npmjs.org/
#- run: npm ci
#- run: npm publish
#env:
#NODE_AUTH_TOKEN: ${{secrets.npm_token}}
publish-package:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: "cat package.json"
run: cat ./package.json
- uses: actions/setup-node@v1
with:
node-version: 10
registry-url: https://npm.pkg.github.com/
- name: "Automated Version Bump"
uses: "phips28/gh-action-bump-version@master"
with:
tag-prefix: ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "cat package.json"
run: cat ./package.json
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
# - name: Discord notification for test success
# if: ${{ success() }}
# env:
# DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
# uses: Ilshidur/action-discord@master
# with:
# args: '[SUCCESS] Project {{ EVENT_PAYLOAD.repository.full_name }} has been deployed successfully as a Github Package.'
# - name: Discord notification for test failure
# if: ${{ failure() }}
# env:
# DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
# uses: Ilshidur/action-discord@master
# with:
# args: '[ERROR] Project {{ EVENT_PAYLOAD.repository.full_name }} deployment has failed. Check and fix errors, then start deployment again.'
# - name: Discord notification for test cancel
# if: ${{ cancelled() }}
# env:
# DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
# uses: Ilshidur/action-discord@master
# with:
# args: '[WARNING] Project {{ EVENT_PAYLOAD.repository.full_name }} deployment has been cancelled and will not be available in a new package version.'