Skip to content

v0.1.4

v0.1.4 #20

Workflow file for this run

name: Release
on:
release:
types:
- published
workflow_dispatch:
inputs:
tag:
description: Release tag to upload assets to
required: true
default: v0.1.4
permissions:
contents: write
env:
RELEASE_REPO: RobinWM/ship-cli
jobs:
build-release-assets:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: node20-linux-x64
asset_name: ship-linux-x64
upload_name: ship-linux-x64
- os: ubuntu-latest
target: node20-linux-arm64
asset_name: ship-linux-arm64
upload_name: ship-linux-arm64
- os: macos-latest
target: node20-macos-x64
asset_name: ship-darwin-x64
upload_name: ship-darwin-x64
- os: macos-latest
target: node20-macos-arm64
asset_name: ship-darwin-arm64
upload_name: ship-darwin-arm64
- os: windows-latest
target: node20-win-x64
asset_name: ship-windows-x64
upload_name: ship-windows-x64.exe
runs-on: ${{ matrix.os }}
env:
RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Build standalone binary
shell: bash
run: |
npm run build
mkdir -p release-assets
npx pkg dist/index.js --targets ${{ matrix.target }} --output release-assets/${{ matrix.asset_name }}
if [ "${{ matrix.asset_name }}" != "${{ matrix.upload_name }}" ]; then
cp "release-assets/${{ matrix.asset_name }}" "release-assets/${{ matrix.upload_name }}"
fi
- name: Upload binary to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: gh release upload "$RELEASE_TAG" "release-assets/${{ matrix.upload_name }}" --repo "$RELEASE_REPO" --clobber
upload-package:
runs-on: ubuntu-latest
env:
RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Build package tarballs
shell: bash
run: |
npm run build
PACKAGE_TGZ="$(npm pack | tail -n 1)"
cp "$PACKAGE_TGZ" ship-latest.tgz
echo "PACKAGE_TGZ=$PACKAGE_TGZ" >> "$GITHUB_ENV"
- name: Upload tarballs to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
gh release upload "$RELEASE_TAG" "$PACKAGE_TGZ" --repo "$RELEASE_REPO" --clobber
gh release upload "$RELEASE_TAG" ship-latest.tgz --repo "$RELEASE_REPO" --clobber