-
-
Notifications
You must be signed in to change notification settings - Fork 3
133 lines (133 loc) · 4.17 KB
/
autoupdate.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
name: Autoupdate
on:
schedule:
- cron: "0 1 * * *"
concurrency:
group: "${{ github.workflow }} @ ${{ github.ref }}"
cancel-in-progress: false
jobs:
update:
env:
SERVICE_ACCOUNT: ${{ secrets.SERVICE_ACCOUNT }}
NODE_VERSION: 20
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
updated: ${{ steps.autoupdate.outputs.updated }}
version: ${{ steps.autoupdate.outputs.version }}
steps:
- name: Сheckout repo
id: checkout_repo
uses: actions/checkout@v3
with:
ref: "master"
path: "tmp"
- name: Set service account
id: set_service_account
run: echo $SERVICE_ACCOUNT>serviceAccount.json
working-directory: ${{ github.workspace }}/tmp
- name: Use Node.js ${{ env.NODE_VERSION }}
id: setup_node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: "https://registry.npmjs.org"
- name: Cache node modules
id: use_cache
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install global dependencies
id: install_global
run: npm install firebase-tools -g
- name: Autoupdate
id: autoupdate
uses: siarheidudko/autoupdater@v3
with:
author-email: "[email protected]"
author-name: "Siarhei Dudko"
working-directory: ${{ github.workspace }}/tmp
ref: ${{ github.repository }}
builds-and-checks: |
npm run lint
npm run build
npm run cov
bash hosting.sh
git add --all
git commit -m 'hosting'
release:
runs-on: ubuntu-latest
timeout-minutes: 20
env:
NODE_VERSION: 20
VERSION: ${{ needs.update.outputs.version }}
needs: [update]
if: ${{ needs.update.outputs.updated == 'true' }}
steps:
- name: Сheckout repo
id: checkout_repo
uses: actions/checkout@v3
with:
ref: "master"
- name: Use Node.js ${{ env.NODE_VERSION }}
id: setup_node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: "https://registry.npmjs.org"
- name: Cache node modules
id: use_cache
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
id: install_ci
run: npm ci
- name: Build package
id: build_package
run: npm run build
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.VERSION }}
release_name: Release v${{ env.VERSION }}
body: |
see [CHANGELOG.md](https://github.com/siarheidudko/firebase-engine/blob/master/CHANGELOG.md)
draft: false
prerelease: false
- name: Publish package to NPM
id: npm_publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: The job has failed - archive npm logs
if: ${{ failure() }}
run: |
if [[ -d /home/runner/.npm/_logs ]]; then
tar -czf ${{ github.workspace }}/npm-logs.tar.gz /home/runner/.npm/_logs;
fi
working-directory: /
- name: The job has failed
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: logs
path: ${{ github.workspace }}/npm-logs.tar.gz
retention-days: 1