Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/karlhorky/vercel-pkg-github-actions-release
Automatic GitHub Releases of packages built with Vercel pkg using GitHub Actions
https://github.com/karlhorky/vercel-pkg-github-actions-release
actions github-actions github-releases pkg vercel
Last synced: 20 days ago
JSON representation
Automatic GitHub Releases of packages built with Vercel pkg using GitHub Actions
- Host: GitHub
- URL: https://github.com/karlhorky/vercel-pkg-github-actions-release
- Owner: karlhorky
- Created: 2022-02-19T14:48:55.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-29T15:08:38.000Z (about 1 year ago)
- Last Synced: 2024-10-25T23:17:36.860Z (2 months ago)
- Topics: actions, github-actions, github-releases, pkg, vercel
- Homepage:
- Size: 28.3 KB
- Stars: 5
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Creating GitHub Releases of `pkg` Executables using GitHub Actions
## Introduction
[Vercel's `pkg`](https://github.com/vercel/pkg) allows packaging a Node.js project into an executable, which can run on devices which don't have Node.js installed.
GitHub Actions can run code on a schedule, allowing for automatically building your `pkg` and releasing to GitHub Releases.
This is a guide to show this. I tried contributing this to the official docs, but unfortunately this was declined by Vercel: https://github.com/vercel/pkg/pull/1246
## Guide
[GitHub Actions](https://docs.github.com/en/actions) can be used to automatically run [`pkg`](https://github.com/vercel/pkg) when a specific event has occurred.
For example, to automatically run `pkg` to create executables and upload them as assets to a new release on GitHub every time a new Git tag is pushed, try setting up [`softprops/action-gh-release`](https://github.com/softprops/action-gh-release) as follows:
1. Add a new file in your project called `.github/workflows/release.yml` (create the directories `.github/workflow` in case they don't exist in your project) and add this file content:
```yaml
name: Build and release
on:
push:
tags:
- 'v*.*.*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- run: yarn --frozen-lockfile
- run: npm install --global pkg
- name: Build
run: pkg index.js --output your-program-name-here --targets linux,macos,win
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
your-program-name-here-linux
your-program-name-here-macos
your-program-name-here-win.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```2. Create a new Git tag with the version that you want:
```bash
git tag -a v1.0.0
```3. Push the new tag to GitHub:
```bash
git push --tags
```This will create a new release under Releases on your GitHub repo that will contain the built executables as assets:
![Releases page on GitHub repo showing release with assets](https://github.com/karlhorky/vercel-pkg-github-actions-release/raw/main/github-release-v1.png)
Every time that you want to create a new release with assets, create a new tag and push it (steps 2 and 3 above).
The final version of the workflow and release:
- Workflow: https://github.com/jonaschlegel/lgo-agisoft-converter/blob/main/.github/workflows/release.yml
- Release: https://github.com/jonaschlegel/lgo-agisoft-converter/releases/tag/v1.0.0