Comments (27)
Could the build files live in a separate branch? Then you could use https://www.npmjs.com/package/gh-pages-deploy for it. We use it do push docs after a deploy, e.g. for https://github.com/hoodiehq/pouchdb-hoodie-api, see https://github.com/hoodiehq/pouchdb-hoodie-api/blob/master/.travis.yml#L24
from semantic-release.
Hi @gr2m. I want the built files to live in the tagged version because that's how bower works. It doesn't make a difference what branch it's in.
from semantic-release.
Then you can achieve that with
- On traves in after_success, run the build task which builds into
/dist
or similar - Copy / create bower.json file in
dist/
folder - Use gh-pages-deploy to push contents of
/dist
folder to adist
branch on GitHub - Point bower to the
dist
branch
That should work, right?
from semantic-release.
Seems like it should. How do I authorize travis to commit to my repo?
from semantic-release.
Travis already has the github token, so we use a smal script for that:
https://github.com/hoodiehq/pouchdb-hoodie-api/blob/master/bin/authorize-push.js
and run it in predeploydocs
from semantic-release.
That looks awesome! Mind open sourcing that so I (and others) can just npm install?
from semantic-release.
Not at all! I'll leave it to @boennemann, just to make sure there is no simpler solution for the root problem you have. Also it's his work, so honor to whom honor is due. Okay for you to copy & paste this for the time being?
from semantic-release.
no problem. I'll let you know how it goes :-)
from semantic-release.
Alright, so I've gotten something that works really well. Here's my semantic-release
process: https://github.com/formly-js/angular-formly/blob/master/package.json#L32
semantic-release pre && npm run build && npm publish && semantic-release post && npm run publish:latest
Note: I need to run the build after pre
because my build depends on the package.json
version
because I publish the version as part of my library (similar to what angular or react do).
Then the publish:latest
is this script which essentially:
- checks out the
latest
branch - merges master
- adds the
dist
directory (the generated files needed for bower) - commits it with the version as the message
- Moves the tag that
semantic-release
just created - Force pushes (so the tag gets moved to the commit with the
dist
directory).
However, I think this is causing some odd behavior. If you look at my releases you'll see that the changelog is getting stacked. Each release has the changes from the previous releases as well as its own. If you look at the output from the travis build you'll see that semantic-release is: "Generating changelog from v6.24.21 to HEAD..." every single release.
Any tips on how I could accomplish what I'm trying to do, but fix the changelog issue are appreciated!
from semantic-release.
So I've changed a few things and now we no longer need to move the release tag (which is great). Here's how things look now:
semantic-release pre && npm run build && npm publish && npm run publish:latest && semantic-release post
So publish:latest
has moved in front of semantic-release post
and here's what it's doing now:
- checks out the
latest
branch - merges
master
- adds the
dist
directory (the generated files needed for bower) - commits it with the version as the message
- Force pushes
latest
(in case there is some kind of divergence for some reason).
All that's changed is I'm no longer moving the tag because it doesn't exist yet. This seems to work great. The only problem is that it's still generating the changelog from 6.24.21
so every release the changelog gets bigger and bigger filled with stuff that's been released before.
from semantic-release.
I think I've found the problem. When I run git describe --tags --abbrev=0
in my repo, I get back v6.24.21
. I'm not sure why it's not showing me the actual latest. Any tips appreciated!
from semantic-release.
I figured out that because I'm actually committing my tags on the latest
branch, I need to change the branch to latest
before conventional-changelog
runs git describe --tags --abbrev=0
. Still working out a few kinks. Hopefully I'll be able to create a plugin to suit this use case better in the future when I'm done :-)
from semantic-release.
Alrighty! I've got it. It's kinda crazy, but it totally works. I'm all set!
from semantic-release.
hi @kentcdodds -- I was just trying to figure out how to get semantic-release
to push to Bower when I came across this post. Do you have some code you can share?
from semantic-release.
Sure, if you look at my comments, I describe exactly what my code does and where it is. You need to alter the semantic-release
script slightly and you'll need to have a script which commits built files and pushes them to a branch (I use latest
). In addition, you'll need to either re-use your GH_TOKEN
on this line or do what I did and have a BOT_GH_TOKEN
which is a token for a bot account.
I'm hoping to make this a plugin eventually. Good luck!
from semantic-release.
I've been using a similar script for sometime now and whilst it's a little hacky, it works. I've written up my workflow in tlvince/tlvince-semantic-release-push-dist, but I'd also love to see a plugin that implements this more robustly.
from semantic-release.
That is quite similar. I'm working on something right now. Hopefully I'll
have it before too long.
-Kent C. Dodds
On Tue, Sep 15, 2015 at 12:56 PM, Tom Vincent [email protected]
wrote:
I've been using a similar script for sometime now and whilst it's a little
hacky, it works. I've written up my workflow in
tlvince/tlvince-semantic-release-push-dist
https://github.com/tlvince/tlvince-semantic-release-push-dist, but I'd
also love to see a plugin that implements this more robustly.—
Reply to this email directly or view it on GitHub
#75 (comment)
.
from semantic-release.
Alrighty, I've open sourced my script. It seems to work great :-) http://npm.im/publish-latest
from semantic-release.
I have the exact same problem with semantic release & bower. Used to have the dist folder in master and to compile it just before creating a new release (really tedious work..).
@kentcdodds Ok, so if I got you correctly, Travis is listening for changes on master, builds etc, uses semantic-release and your script to publish the dist files to latest
which you then tag. You cannot push the dist to master 'cause that would end in an infinite loop 😄. Did I get that correctly?
from semantic-release.
@kentcdodds Hmm..ok. Set it up. Publishing to npm etc works. Tried to hook in your publish-latest
plugin, but it failed. Any idea why: https://travis-ci.org/Swimlane/angular-model-factory/builds/82403298
...
> [email protected] postpublish .
> publish-latest
stderr: fatal: 'travis/temp' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
fatal: Cannot update paths and switch to branch 'dist' at the same time.
Did you intend to checkout 'package.json' which can not be resolved as commit?
stdout: > PL >> setting global git config: latest,
> PL >> running git config --global user.email
> PL >> running git config --global user.name "latest"
> PL >> setting remote
> PL >> running git remote set-url origin travis/temp
> PL >> checking for dist package.json branch
> PL >> dist package.json does not exist on remote... creating it...
> PL >> running git checkout -b dist package.json
...
I don't get why it says this: Please make sure you have the correct access rights
. 'Cause the push of the semantic-release created tag and GitHub release works just fine.
And it also seems to do a weird thing:
Any idea?
Thx!
from semantic-release.
@juristr, you'd be fine to have a dist
in master. Travis just runs the build as normal and it simply commits your built files and pushes them to latest
. It explicitly adds dist
and package.json
(with -f
so it works even if they're .gitignore
d) (the files it adds is configurable). Glad you got it working!
Oh, also, I recommend you do this also, to prevent building the latest
branch.
from semantic-release.
Oh, also, I recommend you do this also, to prevent building the latest branch.
@kentcdodds 👍 thx for the hint.
from semantic-release.
For reference, I recently packaged up two other approaches:
- publish-repo: pushes dist to a separate repository
- publish-dist: commits and pushes dist to master if the last commit was not made by itself
from semantic-release.
Wow these tools are all very nice 👍 Would someone mind adding them to the readme via a PR?
from semantic-release.
Huh... @tlvince is there a reason you didn't just use publish-latest
? You know you can publish to a separate repository, to master, OR to the latest
branch with it right?
from semantic-release.
@kentcdodds NIH? 😅 In all seriousness, I didn't realise publish-latest was that flexible; I thought it only concerned itself with one scenario (publishing to a branch). I guess I didn't look very hard! (I'd also been using the scripts in different projects for quite some time before and wanted to consolidate them).
from semantic-release.
That's my bad for not calling that out in the documentation well enough.
from semantic-release.
Related Issues (20)
- Semantic-Release can't access to Azure DevOps OnPrem server Git - fatal: Authentication failed
- JSR suggestion HOT 4
- Add plugin semantic-release-hackage
- bad substitution when using nextRelease.version or nextRelease.notes
- fatal: tag already exists HOT 5
- Fetch branches in parallel HOT 1
- Pre-release "counter" not incrementing HOT 6
- Unexpected Minor Version Bump in Beta Release Sequence HOT 9
- Missing Release Notes HOT 1
- Publishing a GitHub release & triggering another workflow HOT 2
- Allow --dry-run option to ignore configured release branches HOT 3
- An error occurred while running semantic-release: SyntaxError: Unexpected identifier 'assert' HOT 6
- Allow branches not under --heads (/ref/heads) to be used as release branches HOT 3
- --plugins CLI flag does not honor plugin configurations
- An error occurred while running semantic-release: Error: Cannot find module `@semantic-release/changelog` HOT 3
- releaserc didn't produce expected results HOT 2
- RangeError: Invalid time value HOT 7
- RangeError: Invalid time value HOT 3
- Add `--pre-release` option to "force" a prerelease on the current branch if possible
- Cannot pass build number to use in tag format HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from semantic-release.