Skip to content

Commit

Permalink
feat(release): activate semantic release
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarre committed Mar 18, 2023
1 parent 4d49b4a commit 9c7d5ec
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 3 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily

- package-ecosystem: npm
directory: /
schedule:
interval: daily
45 changes: 45 additions & 0 deletions .github/workflows/dependabot-dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Dependabot post-update
on:
pull_request_target:
types: [opened, synchronize, reopened]
branches: main

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
post-update:
if: ${{ github.actor == 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Checkout out pull request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr checkout ${{ github.event.pull_request.number }}
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'

- run: npm install --frozen-lockfile

- run: npm run prepare

- name: Commit and push if needed
run: |
git add .
if [ -z "$(git status --porcelain)" ]; then
echo "💾 no changes to dist/index.js"
exit 0
fi
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "Apply dist/index.js changes"
git push
echo "💾 pushed dist/index.js changes"
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release

on:
push:
branches: [main, develop]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'

- run: npm run prepare
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "❌ Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
- name: 📦 Semantic Release
if: github.ref == 'refs/heads/main'
id: release
uses: cycjimmy/semantic-release-action@v2
with:
extra_plugins: |
@semantic-release/exec
@semantic-release/git
@semantic-release/release-notes-generator
conventional-changelog-conventionalcommits
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68 changes: 68 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"branches": "main",
"debug": "false",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/github",
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": ":rocket: Features",
"hidden": false
},
{
"type": "features",
"section": ":rocket: Features",
"hidden": false
},
{
"type": "fix",
"section": ":bug: Bug Fixes",
"hidden": false
},
{
"type": "docs",
"section": ":memo: Documentation",
"hidden": false
},
{
"type": "style",
"section": ":barber: Styles",
"hidden": false
},
{
"type": "refactor",
"section": ":zap: Code Refactoring",
"hidden": false
},
{
"type": "perf",
"section": ":fast_forward: Performance Improvements",
"hidden": false
},
{
"type": "test",
"section": ":white_check_mark: Tests",
"hidden": false
},
{
"type": "ci",
"section": ":repeat: Continuous Integration",
"hidden": false
},
{
"type": "chore",
"section": "Miscellaneous Chores",
"hidden": false
}
]
}
}
]
]
}
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "setup-duckdb-action",
"version": "1.0.0",
"description": "",
"main": "index.js",
"description": "Github action that installs DuckDB with the version provided in input.",
"main": "dist/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand All @@ -11,7 +11,6 @@
"license": "ISC",
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/github": "^5.1.1",
"axios": "^1.3.4"
}
}

0 comments on commit 9c7d5ec

Please sign in to comment.