Skip to content

Commit cf0a7b9

Browse files
authored
Merge pull request #1 from nebulab/kennyadsl/release-dev-orb-on-push
Release a new development version at each commit push
2 parents 16faa98 + c6cc7bd commit cf0a7b9

File tree

3 files changed

+42
-4
lines changed

3 files changed

+42
-4
lines changed

.github/main.workflow

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1-
workflow "Release a new version" {
1+
workflow "Release a new production version" {
22
on = "release"
33
resolves = ["publish-on-orbs-registry"]
44
}
55

6+
workflow "Release a new development version" {
7+
on = "push"
8+
resolves = ["publish-on-orbs-registry-dev"]
9+
}
10+
611
action "publish-on-orbs-registry" {
712
uses = "./publish-on-orbs-registry/"
813
secrets = ["CIRCLECI_TOKEN"]
914
}
15+
16+
action "publish-on-orbs-registry-dev" {
17+
uses = "./publish-on-orbs-registry/"
18+
secrets = ["CIRCLECI_TOKEN"]
19+
args = "dev"
20+
}

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ workflows:
3737

3838
## Publish on Orbs Registry
3939

40+
To publish CircleCI Orbs we use GitHub Actions configured under `.github`
41+
folder. Here's how to release an Orb, both for production and development:
42+
43+
#### Production Release
44+
4045
To publish a new version it's just needed to [create a new release on this
4146
repository](https://github.com/nebulab/circleci-orbs-feature-branch-preview/releases).
4247
A GitHub action will take care of everything else.
@@ -47,6 +52,20 @@ so:
4752
- `1.5.0` :thumbsup:
4853
- `v1.2` :thumbsdown:
4954

55+
#### Development Release
56+
57+
Everytime you push a commit into master or any other branch, a GitHub Action
58+
will be triggered to relese a development version of the Orb, scoped by
59+
branch name.
60+
61+
For example if you push a commit into the `your-username/my-feature` branch,
62+
a new development orb will be published as
63+
`nebulab/feature-branch-preview@dev:your-username-my-feature`.
64+
65+
**NOTE:** Development orbs are mutable and expire after 90 days. If someone
66+
else pushes a new commit on the same branch your development orb will be
67+
overwritten.
68+
5069
## Contributing
5170

5271
Bug reports and pull requests are welcome!
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
#!/bin/sh -l
22

3-
# $GITHUB_REF is something like "refs/tags/1.6.2" and we need to take
4-
# only the last part of it.
5-
version=${GITHUB_REF/refs\/tags\//}
3+
env=$1
4+
5+
if [ $env == "dev" ]; then
6+
# $GITHUB_REF is something like "refs/heads/branch-name"
7+
git_branch=${GITHUB_REF/refs\/heads\//}
8+
version_without_slash=${git_branch//\//-}
9+
version="dev:${version_without_slash}"
10+
else
11+
# $GITHUB_REF is something like "refs/tags/1.6.2"
12+
version=${GITHUB_REF/refs\/tags\//}
13+
fi
614

715
echo "Trying to publish orb with version ${version}"
816
circleci orb publish source.yml "nebulab/feature-branch-preview@${version}" --token $CIRCLECI_TOKEN

0 commit comments

Comments
 (0)