Skip to content

Commit

Permalink
chore: update semantic-release config
Browse files Browse the repository at this point in the history
  • Loading branch information
robertrossmann committed May 5, 2020
1 parent cc738f0 commit ffed058
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:

- run: make install
- run: make compile
- name: Publish to npm
- name: Semantic Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Post-release sync
run: ./utils/ci/sync.sh
if: success() && endsWith(github.ref, 'release')
if: success()
4 changes: 2 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ pristine: distclean
rm -rf node_modules

release/latest:
utils/make/release.sh release
utils/make/release.sh release/latest

release/next:
utils/make/release.sh release/next noclean
utils/make/release.sh release/next

.PHONY: force

Expand Down
6 changes: 2 additions & 4 deletions release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ module.exports = {
// eslint-disable-next-line no-template-curly-in-string
tagFormat: '${version}',
branches: [
// TODO: Ideally the default release branch would be release/latest
// but semantic-release refuses to work with a default branch with a slash, apparently 🤷‍♂️
{ name: 'release' },
{ name: 'release/next', channel: 'next', prerelease: 'beta' },
{ name: 'release/latest', channel: 'latest' },
{ name: 'release/next', channel: 'next', prerelease: 'alpha' },
],

plugins: [
Expand Down
9 changes: 4 additions & 5 deletions utils/ci/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

set -o errexit

head=$(git rev-parse --abbrev-ref HEAD)

printf "\n=====>\tFetching new commits...\n"

# Ensure we are merging the release into current branch tips to avoid pushes being rejected
git fetch origin

printf "\n=====>\tMerging to master...\n"
printf "\n=====>\tMerging to master: %s...\n" "${head}"

git checkout master
git merge release
git merge "${head}"

# Print the repo status after merging, for troubleshooting purposes
git status
Expand All @@ -19,6 +21,3 @@ git log --oneline HEAD~10..HEAD
printf "\n=====>\tPushing...\n"

git push origin master

printf "\n=====>\tCleaning up...\n"
git push origin :release
13 changes: 5 additions & 8 deletions utils/make/release.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
#!/bin/sh

branch="$1"
noclean="$2"

set -o errexit

head=$(git rev-parse --abbrev-ref HEAD)

printf "\n=====>\tCreating release branch: %s...\n" "${branch}"
printf "\n=====>\tChecking out release branch: %s...\n" "${branch}"

git checkout -B "${branch}"

printf "\n=====>\tMerging %s...\n" "${head}"

git merge --message "chore: release" "${head}"

printf "\n=====>\tPushing...\n"

git push --set-upstream origin "${branch}"
Expand All @@ -19,10 +22,4 @@ printf "\n=====>\tSwitching back to previous branch: %s...\n" "${head}"

git checkout "${head}"

if [ "${noclean}" != "noclean" ]; then
printf "\n=====>\tDeleting local release branch: %s...\n" "${branch}"

git branch --delete "${branch}"
fi

printf "\n=====>\tRelease in progress: https://github.com/strvcom/heimdall/actions\n"

0 comments on commit ffed058

Please sign in to comment.