feat(ci): added auto release actions to GitHub Actions (#48)

* feat(ci): added auto release actions to GitHub Actions

* Update .github/workflows/release.yml

Co-authored-by: Giau. Tran Minh <[email protected]>

* update branches

* use github.token

* Update .releaserc.js

Co-authored-by: Giau. Tran Minh <[email protected]>
This commit is contained in:
Evan BaconandGiau. Tran Minh authored and GitHub committed 2022-03-15 16:38:04 -05:00
1 parent 119e31edf1
commit cf5c3fe7c4
8 files changed
+2255 -88

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@ name: Check Markdown links
on:
workflow_dispatch: {}
push:
branches: [master]
branches: [main]
paths:
- .github/workflows/lint-md.yml
- "**.md"
+25
View File
@@ -0,0 +1,25 @@
name: PR Title
on:
pull_request:
branches:
- "*"
types:
- opened
- reopened
- edited
- synchronize
jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: aslafy-z/[email protected]
# continue-on-error: true
id: title-check
with:
success-state: PR title is valid
failure-state: "PR title does not follow the conventional commit spec: https://www.conventionalcommits.org/en/v1.0.0/"
context-name: pr-title
preset: conventional-changelog-angular@latest
env:
GITHUB_TOKEN: ${{ github.token }}
+32
View File
@@ -0,0 +1,32 @@
name: Release
# https://github.com/bent10/monorepo-starter/blob/main/docs/recipes/release-automation.md
on:
push:
branches:
- main
jobs:
release:
name: Releasing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn install --frozen-lockfile --check-files
- run: yarn lerna run prepare --stream
# https://github.com/dhoulb/multi-semantic-release
- name: Semantic release
# use `--ignore-packages` to ignore packages on bumping process
# npx multi-semantic-release --ignore-packages=packages/a/**,packages/b/**
run: npx multi-semantic-release
env:
GITHUB_TOKEN: ${{ github.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
+1 -1
View File
@@ -1,7 +1,7 @@
name: Test Packages
on:
push:
branches: [master]
branches: [main]
pull_request:
types: [opened, synchronize]
+62
View File
@@ -0,0 +1,62 @@
// From @byCedric https://github.com/expo/expo-github-action/blob/main/.releaserc.js
const rules = [
{ type: "feat", release: "minor", title: "Features" },
{ type: "fix", release: "patch", title: "Bug Fixes" },
{ type: "test", release: "patch", title: "Tests" },
{ type: "ci", release: "patch", title: "Continuous Integration" },
{ type: "refactor", release: "patch", title: "Code Refactoring" },
{ 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}",
repositoryUrl: "https://github.com/expo/config-plugins.git",
plugins: [
[
"@semantic-release/commit-analyzer",
{
preset: "conventionalcommits",
releaseRules: [
{ breaking: true, release: "major" },
{ revert: true, release: "patch" },
].concat(
rules.map(({ type, release, breaking }) => ({
type,
release,
breaking,
}))
),
},
],
[
"@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/git",
{
message: "chore: ${nextRelease.version}\n\n${nextRelease.notes}",
assets: ["package.json", "CHANGELOG.md", "build/*"],
},
],
"@semantic-release/github",
"@semantic-release/npm",
],
};
+15
View File
@@ -0,0 +1,15 @@
# Contributing to Expo Config Plugins
## Submitting a pull request
To submit a pull request:
1. Fork the [repository](https://github.com/expo/config-plugins) and create a feature branch. (Existing contributors can create feature branches without forking. Prefix the branch name with `@your-github-username/`.)
2. Use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) including in the PR tile.
3. Fill out the entire PR template. Ensure your code is tested locally and has continuous tests in CI.
4. Make sure all tests pass on GitHub Actions.
5. Wait for a review and adjust the code if necessary.
## Publishing a release
All publishing should be handled automatically whenever code is merged to `main`.
+11
View File
@@ -13,6 +13,17 @@
],
"devDependencies": {
"@expo/package-manager": "^0.0.43",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/commit-analyzer": "^9.0.2",
"@semantic-release/error": "^3.0.0",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^8.0.2",
"@semantic-release/npm": "^9.0.1",
"@semantic-release/release-notes-generator": "^10.0.3",
"conventional-changelog-conventionalcommits": "^4.6.3",
"multi-semantic-release": "^2.11.1",
"semantic-release": "^19.0.2",
"@types/js-yaml": "^4.0.5",
"@types/prompts": "^2.0.13",
"expo-yarn-workspaces": "^1.5.1",
+2108 -86
View File
File diff suppressed because it is too large. Load diff