-
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (58 loc) · 1.81 KB
/
Copy pathbuild-and-deploy.yml
File metadata and controls
58 lines (58 loc) · 1.81 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
name: Build and deploy
on:
push:
tags: ["v*.*.*"]
workflow_dispatch:
inputs:
tag: { required: true, type: string }
workflow_call:
inputs:
tag: { required: true, type: string }
permissions:
id-token: write
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
NODE_VERSION: 24
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with: { node-version: "${{ env.NODE_VERSION }}" }
- uses: actions/cache@v4
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 }}-
- run: npm ci
- run: npm run build
- run: |
if [ -n "${{ inputs.tag }}" ]; then
RELEASE_VERSION="${{ inputs.tag }}"
else
RELEASE_VERSION="${GITHUB_REF#refs/*/}"
fi
echo "RELEASE_VERSION=${RELEASE_VERSION#v}" >> $GITHUB_ENV
- uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.RELEASE_VERSION }}
name: v${{ env.RELEASE_VERSION }}
body_path: ${{ github.workspace }}/README.md
repository: siarheidudko/firebase-admin-cli
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: ${{ !!endsWith(env.RELEASE_VERSION, '-beta') }}
- if: ${{ !endsWith(env.RELEASE_VERSION, '-beta') }}
uses: actions/setup-node@v6
with:
registry-url: "https://registry.npmjs.org"
- run: npm install -g npm@latest
- if: ${{ !endsWith(env.RELEASE_VERSION, '-beta') }}
run: npm publish