Skip to content

Commit

Permalink
v0.9.1
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
prescottprue authored Dec 4, 2019
1 parent 4264801 commit 8893e78
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# These are supported funding model platforms

# github: [prescottprue]
github: prescottprue
patreon: prescottprue
open_collective: react-redux-firebase

18 changes: 0 additions & 18 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Bug report
about: Create a report to help us improve
---

**Describe the bug**
<!-- A clear and concise description of what the bug is. -->

**To Reproduce**
Steps to reproduce the behavior:
<!--
1. Go to '...'
1. Click on '....'
1. Scroll down to '....'
1. See error
-->

**Expected behavior/code**
A clear and concise description of what you expected to happen (or code).

**Possible Solution**
<!--- Only if you have suggestions on a fix for the bug -->

**Additional Context/Screenshots**
<!-- Add any other context about the problem here. If applicable, add screenshots to help explain. -->
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Feature request
about: Suggest an idea for this project
---

**Is your feature request related to a problem? Please describe.**

<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->

**Describe the solution you'd like**

<!-- A clear and concise description of what you want to happen. -->

**Describe alternatives you've considered**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->

**Additional context**
<!-- Add any other context or screenshots about the feature request here. -->
4 changes: 1 addition & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
### Description

Write here

### Check List

- [ ] All test passed
- [ ] Added test to ensure to fix/ensure properly.
- [ ] Docs updated where nessesary
20 changes: 13 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,23 @@ jobs:
with:
name: firebase-ci-build

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

# - name: Semantic Release
# id: semantic # Need an `id` for output variables
# uses: cycjimmy/semantic-release-action@v2
# with:
# extra_plugins: |
# @jedmao/semantic-release-npm-github-config
# env:
# GH_TOKEN: ${{ secrets.GH_TOKEN }}
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

# - name: Do something when a new release published
# if: steps.semantic.outputs.new_release_published == 'true'
# run: ...
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "firebase-ci",
"version": "0.9.0",
"version": "0.9.1",
"description": "Simplified Firebase interaction for continuous integration including deploying hosting, functions, and database/storage rules.",
"main": "lib/index.js",
"bin": {
Expand Down
37 changes: 21 additions & 16 deletions src/actions/deploy.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { isUndefined, compact, get } from 'lodash'
import commandExists from 'command-exists'
import { get } from 'lodash'
import chalk from 'chalk'
import copyVersion from './copyVersion'
import mapEnv from './mapEnv'
import { getFile, functionsExists } from '../utils/files'
import { error, info, warn } from '../utils/logger'
import { runCommand } from '../utils/commands'
import { installDeps, getNpxExists } from '../utils/deps'
import { installDeps } from '../utils/deps'
import {
getBranch,
isPullRequest,
Expand Down Expand Up @@ -38,24 +39,27 @@ function getFirebaseTokenStr() {
* @returns {Promise} Resolves after actions are run
* @private
*/
export function runActions() {
export async function runActions() {
copyVersion()
const settings = getFile('.firebaserc')

if (functionsExists() && settings.ci && settings.ci.mapEnv) {
return mapEnv().catch(err => {
// Run map env
const [mapEnvErr] = await to(mapEnv())
if (mapEnvErr) {
error(
'Could not map CI environment variables to Functions environment: ',
err
mapEnvErr
)
return Promise.reject(err)
})
throw mapEnvErr
}
}

info(
`No ci action settings found in ${chalk.cyan(
'.firebaserc'
)}. Skipping action phase.`
)
return Promise.resolve({})
}

/**
Expand All @@ -69,7 +73,7 @@ export default async function deploy(opts) {
const settings = getFile('.firebaserc')
const firebaseJson = getFile('firebase.json')
const branchName = getBranch()
if (isUndefined(branchName) || (opts && opts.test)) {
if (typeof branchName === 'undefined' || (opts && opts.test)) {
const nonCiMessage = `${chalk.cyan(
skipPrefix
)} - Not a supported CI environment`
Expand Down Expand Up @@ -144,14 +148,15 @@ export default async function deploy(opts) {

// Run CI actions if enabled (i.e. copyVersion, createConfig)
if (!opts.simple) {
runActions(opts.actions)
await runActions(opts.actions)
} else {
info('Simple mode enabled. Skipping CI actions')
}

const firebaseTokenStr = getFirebaseTokenStr()
const npxExists = getNpxExists()
let deployArgs = compact([
const npxExists = commandExists.sync('npx')

const deployArgs = [
'deploy',
...onlyString.split(' '),
...firebaseTokenStr.split(' '),
Expand All @@ -160,15 +165,17 @@ export default async function deploy(opts) {
projectKey,
'--message',
message
])
].filter(Boolean)

if (process.env.FIREBASE_CI_DEBUG || settings.debug) {
deployArgs = deployArgs.concat(['--debug'])
deployArgs.push('--debug')
info(`Calling deploy with: ${deployArgs.join(' ')}`)
}

info(
`Deploying to ${branchName} branch to ${projectKey} Firebase project "${projectName}"`
)

// Run deploy command
const [deployErr] = await to(
runCommand({
Expand All @@ -183,6 +190,4 @@ export default async function deploy(opts) {
error('Error in deploying to firebase:\n ', deployErr)
throw deployErr
}

return null
}
9 changes: 5 additions & 4 deletions src/actions/mapEnv.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { map, get, compact } from 'lodash'
import { map, get } from 'lodash'
import chalk from 'chalk'
import { error, info, warn } from '../utils/logger'
import { getFile } from '../utils/files'
Expand Down Expand Up @@ -32,9 +32,10 @@ function strFromEnvironmentVarSetting(functionsVar, envVar) {
* @returns {Array} List of arguments for setting functions config
*/
function buildConfigSetArgs(mapEnvSettings) {
const settingsStrsArr = compact(
map(mapEnvSettings, strFromEnvironmentVarSetting)
)
const settingsStrsArr = map(
mapEnvSettings,
strFromEnvironmentVarSetting
).filter(Boolean)
if (!settingsStrsArr.length) {
return null
}
Expand Down

0 comments on commit 8893e78

Please sign in to comment.