Skip to content

Commit

Permalink
No code: add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
notmgsk committed Jul 13, 2021
1 parent 0f2128c commit 7162ba3
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Release

on:
push:
branches:
- main
- rc

jobs:
release:
name: Semantic Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Install Semantic Release Dependencies
run: npm install
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
39 changes: 39 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "simquil-semantic-release",
"version": "1.0.0",
"description": "Encapsulate dependencies needed to use semantic-release",
"dependencies": {
"@semantic-release/exec": "^5.0.0",
"@semantic-release/git": "^9.0.0",
"@semantic-release/gitlab": "^6.0.4",
"conventional-changelog-eslint": "^3.0.8",
"semantic-release": "^17.1.1"
},
"release": {
"branches": ["main", {"name": "rc", "prerelease": true}],
"plugins": [
["@semantic-release/commit-analyzer",{
"preset": "eslint",
"releaseRules": [
{"tag": "Breaking", "release": "minor"},
{"tag": "Update", "release": "patch"},
{"tag": "Fix", "release": "patch"},
{"tag": "New", "release": "patch"},
{"tag": "Upgrade", "release": "patch"}
]
}],
["@semantic-release/release-notes-generator", {
"preset": "eslint"
}],
["@semantic-release/exec",{
"prepareCmd": "sh prepare_release.sh ${nextRelease.version}"
}],
"@semantic-release/github",
["@semantic-release/git", {
"assets": ["Cargo.toml"],
"message": "Release v${nextRelease.version} [skip ci]"
}]
],
"repositoryUrl": "ssh://[email protected]/notmgsk/simquil.git"
}
}
12 changes: 12 additions & 0 deletions prepare_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

### This script is called by Semantic Release after determining a new version
### for the package and prior to pushing it back to GitHub

set -ex

[[ $1 == "" ]] && echo "usage: $0 <new version string>" && exit 1

# We use sed to bump the version to avoid having to install or use any other tools
sed -i.bak -E "s/^version = \".+\"$/version = \"$1\"/" Cargo.toml
rm Cargo.toml.bak

0 comments on commit 7162ba3

Please sign in to comment.