Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
feat(action): migrate from docker to node
Browse files Browse the repository at this point in the history
This migration improves performance because no Docker image should be created at each run. The `dist/index.js` can run directly, reducing the time needed for the action to run.

The `dist/index.js` script is automatically updated by Semantic Release when a new release is created with `npm run build` command. This npm command relies on `@vercel/ncc` to merge files to a single `dist/index.js` file.

I also added the `@semantic-release/npm` plugin in order to update the `version` field in `package.json` and `package-lock.json`. I set `npmPublish` to `false` because we don't need it.

Before:
![before](https://user-images.githubusercontent.com/44783088/231568415-7c32495a-86d6-48c8-ba33-0fa7ef978851.png)

After:
![after](https://user-images.githubusercontent.com/44783088/231568592-c73ee502-7cfb-42a1-a93f-4a8a354704a8.png)
  • Loading branch information
iamludal committed Aug 9, 2023
1 parent 84bb443 commit e99b2c2
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 82 deletions.
3 changes: 0 additions & 3 deletions .dockerignore

This file was deleted.

5 changes: 0 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,3 @@ updates:
directory: "/"
schedule:
interval: "daily"
# Maintain dependencies for docker
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
61 changes: 0 additions & 61 deletions .github/workflows/docker-image.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
with:
extra_plugins: |
conventional-changelog-conventionalcommits@latest
@semantic-release/exec@6.0.3
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
- name: Push updates to branch for major version
Expand Down
7 changes: 0 additions & 7 deletions Dockerfile

This file was deleted.

4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ inputs:
required: false
default: https://www.conventionalcommits.org/en/v1.0.0/#summary
runs:
using: docker
image: Dockerfile
using: node16
main: dist/index.js
branding:
icon: shield
color: green
17 changes: 17 additions & 0 deletions dist/index.js

Large diffs are not rendered by default.

18 changes: 17 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "conventional-pr-title-action",
"version": "0.1.0",
"version": "3.0.1",
"description": "Ensure your PR title matches the Conventional Commits spec.",
"main": "src/index.js",
"scripts": {
"test": "jest src",
"release": "semantic-release"
"release": "semantic-release",
"build": "ncc build src/index.js -o dist -m"
},
"repository": {
"type": "git",
Expand All @@ -30,6 +31,7 @@
"npm-package-arg": "^10.1.0"
},
"devDependencies": {
"@vercel/ncc": "^0.36.1",
"jest": "29.5.0"
},
"engines": {
Expand Down
10 changes: 9 additions & 1 deletion release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ module.exports = {
plugins: [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/git",
["@semantic-release/exec", {
prepareCmd: "npm ci && npm run build",
}],
["@semantic-release/npm", {
npmPublish: false,
}],
["@semantic-release/git", {
assets: ["package.json", "package-lock.json", "dist"],
}],
"@semantic-release/github",
],
};

0 comments on commit e99b2c2

Please sign in to comment.