-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (64 loc) · 2.08 KB
/
release-db.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
# =================================================== #
# Automatically Generated Workflow File, DO NOT EDIT! #
# =================================================== #
name: Release Package (with DB)
on:
workflow_call:
secrets:
git_token:
required: false
npm_token:
required: true
jobs:
release:
runs-on: ubuntu-latest
name: Release Package (with DB)
services:
postgres:
image: postgres:13
env:
POSTGRES_USER: github
POSTGRES_PASSWORD: github
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
token: ${{ secrets.git_token || github.token }}
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org
node-version: 20
- name: Build Package
run: |
npm clean-install
npm run build
env:
PGPASSWORD: github
PGHOST: localhost
PGUSER: github
PGPORT: 5432
- name: Publish Package
run: |
VERSION="$(node -p 'require("./package.json").version')"
test -z "$(git ls-remote --tags origin "v${VERSION}")" || {
echo "Release ${VERSION} already tagged, exiting..."
echo "::notice::Release ${VERSION} already tagged"
exit 0
}
git config user.email '[email protected]'
git config user.name 'Github Workflows'
git tag -a -m "v${VERSION}" "v${VERSION}" "${{ github.sha }}"
git push --tags
gh release create "v${VERSION}" \
--title "Release ${VERSION}" \
--target "${{ github.sha }}" \
--verify-tag
node -e 'process.exitCode=require("./package.json").workspaces?1:0' && \
npm publish || npm publish --workspaces
env:
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
GH_TOKEN: ${{ github.token }}