Skip to content

Commit 8893e78

Browse files
authored
v0.9.1
* fix(ci): switch to simple npm publish in publish workflow (in place of semantic-release) * chore(core): replace lodash methods with native js methods * chore(github): separate issue template into bug_report and feature_request templates * chore(github): add github funding link
1 parent 4264801 commit 8893e78

File tree

9 files changed

+85
-50
lines changed

9 files changed

+85
-50
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# These are supported funding model platforms
22

3-
# github: [prescottprue]
3+
github: prescottprue
44
patreon: prescottprue
55
open_collective: react-redux-firebase
66

.github/ISSUE_TEMPLATE.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
---
5+
6+
**Describe the bug**
7+
<!-- A clear and concise description of what the bug is. -->
8+
9+
**To Reproduce**
10+
Steps to reproduce the behavior:
11+
<!--
12+
1. Go to '...'
13+
1. Click on '....'
14+
1. Scroll down to '....'
15+
1. See error
16+
-->
17+
18+
**Expected behavior/code**
19+
A clear and concise description of what you expected to happen (or code).
20+
21+
**Possible Solution**
22+
<!--- Only if you have suggestions on a fix for the bug -->
23+
24+
**Additional Context/Screenshots**
25+
<!-- Add any other context about the problem here. If applicable, add screenshots to help explain. -->
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
---
5+
6+
**Is your feature request related to a problem? Please describe.**
7+
8+
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
9+
10+
**Describe the solution you'd like**
11+
12+
<!-- A clear and concise description of what you want to happen. -->
13+
14+
**Describe alternatives you've considered**
15+
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
16+
17+
**Additional context**
18+
<!-- Add any other context or screenshots about the feature request here. -->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
### Description
22

3-
Write here
4-
53
### Check List
64

75
- [ ] All test passed
8-
- [ ] Added test to ensure to fix/ensure properly.
6+
- [ ] Docs updated where nessesary

.github/workflows/publish.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,23 @@ jobs:
9090
with:
9191
name: firebase-ci-build
9292

93-
- name: Semantic Release
94-
id: semantic # Need an `id` for output variables
95-
uses: cycjimmy/semantic-release-action@v2
96-
with:
97-
extra_plugins: |
98-
@jedmao/semantic-release-npm-github-config
93+
- name: Publish To NPM
94+
run: npm publish $(if [ ${{github.ref}} == 'refs/heads/next' ]; then echo '--tag next';fi;)
9995
env:
100-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
10196
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
10297
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
10398

99+
# - name: Semantic Release
100+
# id: semantic # Need an `id` for output variables
101+
# uses: cycjimmy/semantic-release-action@v2
102+
# with:
103+
# extra_plugins: |
104+
# @jedmao/semantic-release-npm-github-config
105+
# env:
106+
# GH_TOKEN: ${{ secrets.GH_TOKEN }}
107+
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
108+
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
109+
104110
# - name: Do something when a new release published
105111
# if: steps.semantic.outputs.new_release_published == 'true'
106112
# run: ...

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "firebase-ci",
3-
"version": "0.9.0",
3+
"version": "0.9.1",
44
"description": "Simplified Firebase interaction for continuous integration including deploying hosting, functions, and database/storage rules.",
55
"main": "lib/index.js",
66
"bin": {

src/actions/deploy.js

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import { isUndefined, compact, get } from 'lodash'
1+
import commandExists from 'command-exists'
2+
import { get } from 'lodash'
23
import chalk from 'chalk'
34
import copyVersion from './copyVersion'
45
import mapEnv from './mapEnv'
56
import { getFile, functionsExists } from '../utils/files'
67
import { error, info, warn } from '../utils/logger'
78
import { runCommand } from '../utils/commands'
8-
import { installDeps, getNpxExists } from '../utils/deps'
9+
import { installDeps } from '../utils/deps'
910
import {
1011
getBranch,
1112
isPullRequest,
@@ -38,24 +39,27 @@ function getFirebaseTokenStr() {
3839
* @returns {Promise} Resolves after actions are run
3940
* @private
4041
*/
41-
export function runActions() {
42+
export async function runActions() {
4243
copyVersion()
4344
const settings = getFile('.firebaserc')
45+
4446
if (functionsExists() && settings.ci && settings.ci.mapEnv) {
45-
return mapEnv().catch(err => {
47+
// Run map env
48+
const [mapEnvErr] = await to(mapEnv())
49+
if (mapEnvErr) {
4650
error(
4751
'Could not map CI environment variables to Functions environment: ',
48-
err
52+
mapEnvErr
4953
)
50-
return Promise.reject(err)
51-
})
54+
throw mapEnvErr
55+
}
5256
}
57+
5358
info(
5459
`No ci action settings found in ${chalk.cyan(
5560
'.firebaserc'
5661
)}. Skipping action phase.`
5762
)
58-
return Promise.resolve({})
5963
}
6064

6165
/**
@@ -69,7 +73,7 @@ export default async function deploy(opts) {
6973
const settings = getFile('.firebaserc')
7074
const firebaseJson = getFile('firebase.json')
7175
const branchName = getBranch()
72-
if (isUndefined(branchName) || (opts && opts.test)) {
76+
if (typeof branchName === 'undefined' || (opts && opts.test)) {
7377
const nonCiMessage = `${chalk.cyan(
7478
skipPrefix
7579
)} - Not a supported CI environment`
@@ -144,14 +148,15 @@ export default async function deploy(opts) {
144148

145149
// Run CI actions if enabled (i.e. copyVersion, createConfig)
146150
if (!opts.simple) {
147-
runActions(opts.actions)
151+
await runActions(opts.actions)
148152
} else {
149153
info('Simple mode enabled. Skipping CI actions')
150154
}
151155

152156
const firebaseTokenStr = getFirebaseTokenStr()
153-
const npxExists = getNpxExists()
154-
let deployArgs = compact([
157+
const npxExists = commandExists.sync('npx')
158+
159+
const deployArgs = [
155160
'deploy',
156161
...onlyString.split(' '),
157162
...firebaseTokenStr.split(' '),
@@ -160,15 +165,17 @@ export default async function deploy(opts) {
160165
projectKey,
161166
'--message',
162167
message
163-
])
168+
].filter(Boolean)
164169

165170
if (process.env.FIREBASE_CI_DEBUG || settings.debug) {
166-
deployArgs = deployArgs.concat(['--debug'])
171+
deployArgs.push('--debug')
167172
info(`Calling deploy with: ${deployArgs.join(' ')}`)
168173
}
174+
169175
info(
170176
`Deploying to ${branchName} branch to ${projectKey} Firebase project "${projectName}"`
171177
)
178+
172179
// Run deploy command
173180
const [deployErr] = await to(
174181
runCommand({
@@ -183,6 +190,4 @@ export default async function deploy(opts) {
183190
error('Error in deploying to firebase:\n ', deployErr)
184191
throw deployErr
185192
}
186-
187-
return null
188193
}

src/actions/mapEnv.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { map, get, compact } from 'lodash'
1+
import { map, get } from 'lodash'
22
import chalk from 'chalk'
33
import { error, info, warn } from '../utils/logger'
44
import { getFile } from '../utils/files'
@@ -32,9 +32,10 @@ function strFromEnvironmentVarSetting(functionsVar, envVar) {
3232
* @returns {Array} List of arguments for setting functions config
3333
*/
3434
function buildConfigSetArgs(mapEnvSettings) {
35-
const settingsStrsArr = compact(
36-
map(mapEnvSettings, strFromEnvironmentVarSetting)
37-
)
35+
const settingsStrsArr = map(
36+
mapEnvSettings,
37+
strFromEnvironmentVarSetting
38+
).filter(Boolean)
3839
if (!settingsStrsArr.length) {
3940
return null
4041
}

0 commit comments

Comments
 (0)