Skip to content

Build and Release

Build and Release #28

Workflow file for this run

name: Build and Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
default: '1.0.0'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build Docker image
run: docker build . -t my-application
- name: Create Docker container without running it
run: docker create --name app_build my-application
- name: Copy build artifacts from Docker container (Debugging)
run: |
mkdir -p ./dist
docker cp app_build:/usr/src/app/dist/. ./dist/
ls -la ./dist/
- name: Debugging - List container details
run: docker ps -a
package:
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.19.1
cache: 'npm'
- name: Install pkg globally
run: npm install -g pkg
- name: Set PKG_TARGET environment variable
run: |
echo "PKG_TARGET=node18-$(echo ${{ matrix.os }} | sed -e 's/ubuntu-latest/linux/' -e 's/windows-latest/win/' -e 's/macos-latest/macos/')" >> $GITHUB_ENV
- name: Build executable using pkg (Debugging)
run: |
ls -la ./dist
pkg -t ${{ env.PKG_TARGET }} ./dist/main.js
env:
PKG_CACHE_PATH: './.pkg-cache'
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-exe
path: |
./*.exe
./*-linux
./*-macos