Skip to content

Commit

Permalink
chore(ci): setup workflow for release process
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardomourar committed Apr 10, 2023
1 parent b24abb8 commit bb9590f
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"packages": {
".": {
"changelog-path": "CHANGELOG.md",
"release-type": "node",
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"draft": false
}
}
}
3 changes: 3 additions & 0 deletions .github/release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.0.1"
}
16 changes: 16 additions & 0 deletions .github/workflows/commit-message-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: commit-message-lint

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
75 changes: 75 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: release

on:
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
command: manifest
config-file: .github/release-please-config.json
manifest-file: .github/release-please-manifest.json
- uses: actions/checkout@v3
- name: Add files and publish release
if: ${{ steps.release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ github.token }}
TAG_NAME: ${{ steps.release.outputs.tag_name }}
run: |
npm ci
npm run package
mv wit-idl.vsix ${TAG_NAME}.vsix
gh release upload ${TAG_NAME} ${TAG_NAME}.vsix
label:
needs: [publish]
if: ${{ needs.publish.outputs.release_created }}
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
repository-projects: read
steps:
- uses: actions/checkout@v3

- name: Add label to PR
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
PR_NUMBER=$(gh pr list --state merged --label 'autorelease: tagged' --json number --jq '.[0].number')
gh pr edit ${PR_NUMBER} --add-label 'autorelease: published'
comments:
needs: [publish]
if: ${{ needs.publish.outputs.release_created }}
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- uses: apexskier/github-release-commenter@v1
with:
GITHUB_TOKEN: ${{ github.token }}
comment-template: |
:tada: This change has been included in ${{ needs.publish.outputs.tag_name }} :tada:
The release is available on:
- GitHub releases: {release_link}
Your **[release-please](https://github.com/googleapis/release-please)** bot :rocket::pray:
8 changes: 8 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
rules: {
"type-enum": [2, "always", ["build", "chore", "docs", "feat", "fix", "refactor", "style", "test"]],
"body-max-line-length": [0, "always"],
"footer-max-line-length": [0, "always"],
},
};

0 comments on commit bb9590f

Please sign in to comment.