-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add semantic release for easy versioning (#95)
* chore: add semantic release for easy versioning * chore: add workflow to release a new version * docs: add contributing guide for developers
- Loading branch information
Showing
10 changed files
with
144,659 additions
and
115,018 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
name: Release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release: | ||
description: 'type "release" to confirm creating a new release (main branch only)' | ||
required: false | ||
jobs: | ||
release: | ||
name: Release version | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup repo | ||
uses: actions/checkout@v2 | ||
- name: Setup node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14.x | ||
- name: Find cache | ||
id: yarn-cache-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
- name: Restore cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.yarn-cache-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile --check-files | ||
- name: Lint package | ||
run: yarn lint | ||
- name: Test package | ||
run: yarn test | ||
- name: Build clean | ||
run: yarn clean | ||
- name: Build package | ||
run: yarn build | ||
- name: Test-run release | ||
if: success() && github.event.inputs.release != 'release' | ||
run: yarn semantic-release --dry-run | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Create release | ||
if: success() && github.ref == 'refs/heads/main' && github.event.inputs.release == 'release' | ||
run: yarn semantic-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const rules = [ | ||
{ type: 'feat', release: 'minor', title: 'New features' }, | ||
{ type: 'feature', release: 'minor', title: 'New features' }, | ||
{ type: 'fix', release: 'patch', title: 'Bug fixes' }, | ||
{ type: 'refactor', release: 'patch', title: 'Code changes' }, | ||
{ type: 'chore', release: 'patch', title: 'Other chores' }, | ||
{ type: 'docs', release: 'patch', title: 'Documentation changes' }, | ||
]; | ||
|
||
// Simple mapping to order the commit groups | ||
const sortMap = Object.fromEntries(rules.map((rule, index) => [rule.title, index])); | ||
|
||
module.exports = { | ||
branches: ['main'], | ||
tagFormat: '${version}', | ||
plugins: [ | ||
['@semantic-release/commit-analyzer', { | ||
preset: 'conventionalcommits', | ||
releaseRules: rules.map(({ type, release }) => ({ type, release })), | ||
}], | ||
['@semantic-release/release-notes-generator', { | ||
preset: 'conventionalcommits', | ||
presetConfig: { | ||
types: rules.map(({ type, title }) => ({ type, section: title })), | ||
}, | ||
writerOpts: { | ||
commitGroupsSort: (a, z) => sortMap[a.title] - sortMap[z.title], | ||
}, | ||
}], | ||
'@semantic-release/changelog', | ||
['@semantic-release/npm', { npmPublish: false }], | ||
['@semantic-release/git', { | ||
message: 'chore: create new release ${nextRelease.version}\n\n${nextRelease.notes}', | ||
assets: ['package.json', 'CHANGELOG.md'], | ||
}], | ||
'@semantic-release/github', | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Contributing to Expo Github Action | ||
|
||
## 📦 Download and Setup | ||
|
||
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device. (`git remote add upstream [email protected]:expo/vscode-expo.git` 😉) | ||
2. Make sure you have the following packages globally installed on your system: | ||
- [node](https://nodejs.org/) (active Node LTS or higher is recommended) | ||
- [yarn](https://yarnpkg.com/) | ||
3. Install the Node packages (`yarn install`) | ||
|
||
## 🏎️ Running a custom version | ||
|
||
To try out your changed with Github Action, you have [to reference your fork and/or branch or commit reference](https://docs.github.com/en/actions/learn-github-actions/finding-and-customizing-actions#using-release-management-for-your-custom-actions) in the workflow you want to try. After that, you have two options: | ||
|
||
1. Run the workflow in Github Actions itself by triggering your workflow. | ||
2. Run the workflow locally with [nektos/act](https://github.com/nektos/act). | ||
|
||
## ✅ Testing | ||
|
||
Testing is done using [Jest](https://jestjs.io/https://jestjs.io/). Run `yarn test` to run Jest. | ||
|
||
In CI we are running tests on multiple Node versions using Windows, Linux, and MacOS. Make sure they are passing for your PR. | ||
|
||
## 📝 Writing a Commit Message | ||
|
||
> If this is your first time committing to a large public repo, you could look through this neat tutorial: ["How to Write a Git Commit Message"](https://chris.beams.io/posts/git-commit/) | ||
Commit messages are formatted using the [Conventional Commits](https://www.conventionalcommits.org/) format. You can take a look at [`.releaserc.js`](./.releaserc.js) for the allowed commit types. | ||
|
||
``` | ||
docs: fix typo in xxx | ||
feature: add support for SDK 40 | ||
chore: add test-case for custom completions | ||
fix: improve logging for errors | ||
refactor: update loading icon | ||
``` | ||
|
||
## 🔎 Before Submitting a PR | ||
|
||
To get your PR merged as fast as possible, please make sure you have done the following: | ||
|
||
- Run `yarn lint --fix` to fix the formatting of the code. Ensure that `yarn lint` succeeds without errors or warnings. | ||
- Run `yarn test` to make sure all normal use cases are passing. | ||
- Run `yarn build` to ensure the build is up-to-date and runs correctly and without errors or warnings. | ||
|
||
## 🚀 Releasing a new version | ||
|
||
To release a new version for Github Actions, we have to create a new release in Github. You can run the `Release` workflow to generate a new version, changelog, and Github release. |
Oops, something went wrong.