I am trying to log the reports from the build and publish it through the github releases by setting it as a draft releases.
Tried publishing the reports using the travis provider releases. Followed travis doc https://docs.travis-ci.com/user/deployment/releases/#draft-releases-with-draft-true
deploy:
- provider: releases
api_key: $GITHUB_TOKEM <I have set it as environment variable>
file: build.doc
skip_cleanup: true
draft: true
Getting this messaged from the travis log
Skipping a deployment with the releases provider because this branch is not permitted: suresh_branch
Related
I'm working on my first Travis CI project. I'm not sure how it works yet.
The thing is when I try to configure trigger builds (Image example), option appears as not allowed, it doesn't let me click it.
And this is my .travis.yml file:
language: node_js
cache:
directories:
- ~/.npm
node_js:
- '12'
git:
depth: 3
script:
- yarn build
deploy:
provider: pages
edge: true
skip-cleanup: true
keep-history: true
github-token: $GITHUB_TOKEN
local-dir: dist/
target-branch: gh-pages
commit_message: "Deploy Release"
on:
branch: main
Did you try to confirm your account with the email that Travis CI is sent to you?
With the new feature of Travis CI, you will need to confirm your account once your sign up for travis-ci.com. To confirm you get an email that is attached to your GitHub accounts. After confirmation, you will be able to see the "Trigger Build" option visible.
I've set up a Travis CI to run a few scripts that should:
Deploy some static pages to Github pages
Deploy an NPM package to npmjs
Item 1 works, Item 2 doesn't.
Here's what my travis.yml file looks like:
language: node_js
node_js:
- '10'
script:
- gulp build
- gulp npmDist
deploy:
- provider: pages
local_dir: dist-site/
skip_cleanup: true
github_token: "$GITHUB_TOKEN"
on:
branch: master
- provider: npm
email: myemail#mydomain.com
api_key:
secure: THE-API-KEY-I-GOT-BY-CREATING-A-TOKEN-ON-NPMJS-AND-ENCRYPTING-IT-USING-TRAVIS-ENCRYPT-COMMAND-IN-TERMINAL
on:
tags: true
repo: githubaccount/reponame
all_branches: true
I trigger the script in two ways:
- When I merge to master, it deploys to GitHub Pages.
- When I create a tag and push to master it should deploy the package to npmjs.
As stated, the first part of the file works, as it actually deploys to GitHub Pages.
Here's the error I get from npmjs:
npm ERR! publish Failed PUT 401
npm ERR! code E401
npm ERR! You must be logged in to publish packages. : package-name
(oh, and a strange thing: Travis returns with a "Build Passed" and the succesful status (green), even though there's obviously something wrong)
Hope this makes sense? Thanx in advance for any help.
Fixed it — instead of having this in the travis.yml-file:
api_key:
secure: THE-API-KEY-I-GOT-BY-CREATING-A-TOKEN-ON-NPMJS-AND-ENCRYPTING-IT-USING-TRAVIS-ENCRYPT-COMMAND-IN-TERMINAL
I changed it to:
api_key: "$NPM_TOKEN"
..and added the NPM Token as an environment variable inside the Travis CI dashboard.
(Still curious as to why it didn't work, but I can't be bothered to do something about, as I've already wasted way too much time on this issue today)
I had the same problem and I just removed all previous keys and generated them again and my code looks like this:
deploy:
provider: npm
email: $NPM_USER
api_key: $NPM_TOKEN
To create your NPM_TOKEN you must:
Go to your npm profile
Tokens
Create Token
Select "Read and Publish" and create it.
Then you can specify it in your env variables for the corresponding project.
The key do not have to be encrypted and the user is your email. That will be it.
You will receive a notification like:
Installing deploy dependencies
dpl.2
Preparing deploy
dpl.3
Deploying application
+ your-artifact#x.x.x
I have an Asp.Net MVC project that deploys to an Azure App Service via AppVeyor, with an appveyor.yml file that is configured to deploy GitHub commits to both Production and Staging.
The configuration is -
Master branch, use Release configuration.
Staging branch, use Staging configuration.
The staging deployment builds and deploys without issue, however, the staging deployment still targets the "Release" configuration, despite it being set to "Staging" for the Staging branch. I can see this as when I login to staging, it is pointing at the Staging Azure SQL database.
Local Testing
I have tested it locally in Staging configuration, and it works in that regard.
I'm assuming the appveyor.yml file is configured incorrectly, and thus AppVeyor is not picking up the Staging configuration?
version: 1.0.{build}
build_script:
- ps: .\build.cmd CreateNuGet
nuget:
account_feed: true
artifacts:
- path: output\*.*
test: off
for:
# configuration for "master" branch
# build in Release mode and deploy to the Azure prod environment
-
branches:
only:
- master
configuration: Release
deploy:
provider: WebDeploy
server: [removed for brevity]
website: [removed for brevity]
username: [removed for brevity]
password: [removed for brevity]
ntlm: false
remove_files: true
app_offline: false
# configuration for "staging" branch
# build in Staging mode and deploy to the Azure staging environment
-
branches:
only:
- staging
configuration: Staging
deploy:
provider: WebDeploy
server: [removed for brevity]
website: [removed for brevity]
username: [removed for brevity]
password: [removed for brevity]
ntlm: false
remove_files: true
app_offline: false
# "fall back" configuration for all other branches
# no "branches" section defined
# do not deploy at all
configuration: Debug
I suspect the "fall back" configuration is overriding the previously set configuration. By removing this (or possibly moving it to the top of the file) you will achieve the desired outcome.
I've got a Lektor site that I'm trying to deploy automatically in response to pull requests and commits, using the Travis CI trigger approach from the Lektor docs.
The Lektor configuration works fine from the command line.
The Travis build starts, and appears to build the site without problem - but when it gets to deployment, the log says the following:
Installing deploy dependencies
!!! Script support is experimental !!!
Preparing deploy
Cleaning up git repository with `git stash --all`. If you need build artifacts for deployment, set `deploy.skip_cleanup: true`. See https://docs.travis-ci.com/user/deployment/#Uploading-Files.
No local changes to save
Deploying application
Deploying to ghpages-https
Build cache: /home/travis/.cache/lektor/builds/d3a411e13041731555222b901cff4248
Target: ghpages+https://pybee/pybee.github.io?cname=pybee.org
Initialized empty Git repository in /home/travis/build/pybee/pybee.github.io/temp/.deploytemp9xhRDc/scratch/.git/
Fetching origin
fatal: repository 'https://github.com/pybee/pybee.github.io/' not found
error: Could not fetch origin
fatal: repository 'https://github.com/pybee/pybee.github.io/' not found
Done!
For a full log, see here.
I've checked the credentials in the Travis CI configuration for the repository; I'm as certain as I can be that they're correct. I've tried using the same configuration (exporting LEKTOR_DEPLOY_USERNAME and LEKTOR_DEPLOY_PASSWORD locally), and it works fine.
hammer:pybee.org rkm$ lektor deploy ghpages-https
Deploying to ghpages-https
Build cache: /Users/rkm/Library/Caches/Lektor/builds/a269cf944d4302f15f78a1dfb1602486
Target: ghpages+https://pybee/pybee.github.io?cname=pybee.org
Initialized empty Git repository in /Users/rkm/projects/beeware/pybee.org/temp/.deploytempOh4p98/scratch/.git/
Fetching origin
From https://github.com/pybee/pybee.github.io
* [new branch] master -> origin/master
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Everything up-to-date
Done!
Any suggestions on the cause of this error?
It turns out this is a bug in Lektor.
If you use the following in your <project>.lektorproject:
[servers.ghpages-https]
target = ghpages+https://pybee/pybee.github.io?cname=pybee.org
and the following in your .travis.yml:
language: python
python: 2.7
cache:
directories:
- $HOME/.cache/pip
- $HOME/.cache/lektor/builds
install: "pip install git+https://github.com/singingwolfboy/lektor.git#fix-ghpages-https-deploy#egg=lektor"
script: "lektor build"
deploy:
provider: script
script: "lektor deploy ghpages-https"
on:
branch: lektor
(i.e., use the PR branch for deployment), builds will deploy as expected.
I'm looking to declare environment variables in my Travis CI repository settings and use them in my .travis.yml file to deploy an application and post a build notification in Slack.
I've set environment variables in my Travis CI repository settings like so:
My .travis.yml file appears as the following:
language: node_js
node_js:
- '0.12'
cache:
directories:
- node_modules
deploy:
edge: true
provider: cloudfoundry
api: $CF_API
username: $CF_USERNAME
password: $CF_PASSWORD
organization: $CF_ORGANIZATION
space: $CF_SPACE
notifications:
slack: $NOTIFICATIONS_SLACK
When I add the values into the .travis.yml file as they are, everything works as planned.
However, when I try to refer to the environment variables set in the repository, I receive no Slack notification on a build status, and the deployment fails.
Am I following this process correctly or is there something I'm overseeing?
I think it is probably too early in Travis CI's sequence for your environment variables to be read.
What I would suggest is to rather encrypt them using the travis command-line tool.
E.g.
$ travis encrypt
Reading from stdin, press Ctrl+D when done
username
Please add the following to your .travis.yml file:
secure: "TD955qR6qvpVIz3fLkGeeUhV76deeVRaLVYjW9YjV6Ob7wd+vPtACZ..."
Pro Tip: You can add it automatically by running with --add.
Then I would copy/paste the secure: "TD955qR6qvpVIz3fLkGeeUhV76d..." result at the appropriate place in your .travis.yml file:
language: node_js
node_js:
- '0.12'
cache:
directories:
- node_modules
deploy:
edge: true
provider: cloudfoundry
api:
secure: "bHU4+ZDFeZcHpuE/WRpgMBcxr8l..."
username:
secure: "TD955qR6qvpVIz3fLkGeeUhV76d..."
You can have more details about how to encrypt sensitive data on Travis CI here.
Hope this helps.