Skip to content

Commit

Permalink
fix: publish version
Browse files Browse the repository at this point in the history
  • Loading branch information
yugasun committed Mar 23, 2021
1 parent a6be028 commit 2adabe6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion serverless.component.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: scf
version: 0.5.0
version: 0.5.1
author: Tencent Cloud, Inc.
org: Tencent Cloud, Inc.
description: Deploy a serverless cloud function on Tencent Cloud.
Expand Down
21 changes: 12 additions & 9 deletions src/serverless.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class ServerlessComponent extends Component {
console.log(`list alias for function ${inputs.function}...`)
const scf = new Scf(credentials, region)

const scfOutput = await scf.listAlias(alias_params)
const scfOutput = await scf.alias.list(alias_params)
console.log(`list alias for function ${inputs.function}...`)

const aliases = scfOutput.Aliases
Expand Down Expand Up @@ -202,10 +202,10 @@ class ServerlessComponent extends Component {

console.log(`Creating alias for function ${inputs.function}...`)
const scf = new Scf(credentials, region)
await scf.createAlias(alias_params)
await scf.alias.create(alias_params)
console.log(`Creating alias for function ${inputs.function}...`)

const aliasOutput = await scf.getAlias(alias_params)
const aliasOutput = await scf.alias.get(alias_params)

return aliasOutput
} catch (e) {
Expand All @@ -232,10 +232,10 @@ class ServerlessComponent extends Component {
console.log(`Updating alias for function ${inputs.function}...`)
const scf = new Scf(credentials, region)

await scf.updateAlias(alias_params)
await scf.alias.update(alias_params)
console.log(`Updated alias for function ${inputs.function}...`)

const aliasOutput = await scf.getAlias(alias_params)
const aliasOutput = await scf.alias.get(alias_params)

return aliasOutput
} catch (e) {
Expand All @@ -259,7 +259,7 @@ class ServerlessComponent extends Component {
console.log(`delete alias for function ${inputs.function}...`)
const scf = new Scf(credentials, region)

const scfOutput = await scf.deleteAlias(alias_params)
const scfOutput = await scf.alias.delete(alias_params)
console.log(`deleted alias for function ${inputs.function}...`)
return scfOutput
} catch (e) {
Expand All @@ -282,10 +282,13 @@ class ServerlessComponent extends Component {

const scf = new Scf(credentials, region)

const scfOutput = await scf.publishVersion(publish_params)
console.log(`published version for function ${inputs.function}...`)
const scfOutput = await scf.version.publish(publish_params)

await scf.isOperationalStatus(scfOutput.Namespace, inputs.function, scfOutput.FunctionVersion)
await scf.scf.isOperational({
namespace: scfOutput.Namespace,
functionName: inputs.function,
qualifier: scfOutput.FunctionVersion
})

this.state.lastVersion = scfOutput.FunctionVersion
await this.save()
Expand Down

0 comments on commit 2adabe6

Please sign in to comment.