-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: provide executables on release
This adds actions to create executables on every release and adds them as assets to each release, respectively.
- Loading branch information
1 parent
1bad5db
commit eadbd8f
Showing
6 changed files
with
1,213 additions
and
101 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,3 @@ | ||
module.exports = { | ||
extends: ['@commitlint/config-conventional'] | ||
}; |
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,30 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources 🔰 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js 18 👷🏻 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Install dependencies ⏬ | ||
run: npm ci | ||
|
||
- name: Build artifacts 🏗️ | ||
run: npm run package-binaries | ||
|
||
- name: Release 🚀 | ||
uses: cycjimmy/semantic-release-action@v3 | ||
id: semantic | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_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,32 @@ | ||
{ | ||
"branches": ["main"], | ||
"plugins": [ | ||
[ | ||
"@semantic-release/commit-analyzer", | ||
{ | ||
"preset": "conventionalcommits" | ||
} | ||
], | ||
[ | ||
"@semantic-release/release-notes-generator", | ||
{ | ||
"preset": "conventionalcommits", | ||
"presetConfig": { | ||
"header": "Changelog of GeoStyler Client" | ||
} | ||
} | ||
], | ||
"@semantic-release/changelog", | ||
"@semantic-release/npm", | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
"assets": [ | ||
"./binaries/geostyler-cli-linux.zip", "./binaries/geostyler-cli-macos.zip", "./binaries/geostyler-cli-win.exe.zip" | ||
], | ||
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" | ||
} | ||
], | ||
"@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,51 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const AdmZip = require('adm-zip'); | ||
|
||
|
||
// Define the folder path and the list of file names | ||
const folderPath = './binaries/'; | ||
const fileNames = ['geostyler-cli-win.exe', 'geostyler-cli-linux', 'geostyler-cli-macos']; | ||
|
||
function renameFile(oldPath, newPath) { | ||
return new Promise((resolve, reject) => { | ||
fs.rename(oldPath, newPath, (error) => { | ||
if (error) { | ||
reject(error); | ||
} else { | ||
resolve(); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
// Function to execute the renaming and zipping process | ||
async function processFiles() { | ||
try { | ||
for (const fileName of fileNames) { | ||
const filePath = folderPath + fileName; | ||
const renamedFilePath = folderPath + fileName.replace('-win', '').replace('-macos', '').replace('-linux', ''); | ||
|
||
// Rename the file | ||
await renameFile(filePath, renamedFilePath); | ||
|
||
// Zip the file | ||
const outputZipFilePath = filePath + '.zip'; | ||
const zip = new AdmZip(); | ||
zip.addLocalFile(renamedFilePath); | ||
|
||
// Save the zip archive | ||
zip.writeZip(outputZipFilePath); | ||
|
||
// Rename the zipped file back to its original name | ||
await renameFile(renamedFilePath, filePath); | ||
console.log(`Processed file: ${fileName}`); | ||
Check warning on line 42 in package-binaries.js GitHub Actions / build (18.x)
|
||
} | ||
|
||
console.log('All files processed successfully.'); | ||
Check warning on line 45 in package-binaries.js GitHub Actions / build (18.x)
|
||
} catch (error) { | ||
console.error('An error occurred:', error); | ||
Check warning on line 47 in package-binaries.js GitHub Actions / build (18.x)
|
||
} | ||
} | ||
|
||
processFiles(); |
Oops, something went wrong.