Skip to content

Replaced deprecated Github Action for uploading release assets (#54) #143

Replaced deprecated Github Action for uploading release assets (#54)

Replaced deprecated Github Action for uploading release assets (#54) #143

Workflow file for this run

name: CI for nexe builds
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
# Create nexe build for later use
build_and_publish:
name: Build nexe
runs-on: ${{ matrix.os }}
timeout-minutes: 180
defaults:
run:
shell: bash
strategy:
matrix:
# NOTE: macos-13 = x64, macos-14 & macos-15 = arm64
os: [ubuntu-latest, windows-2019, macos-latest]
node_version: ['18.20.7']
steps:
- uses: actions/checkout@v3
- name: Use Node.js from .nvmrc
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Declare caches for build
uses: actions/cache@v3
with:
path: |
~/.ccache/
key: ${{ matrix.os }}-${{ matrix.node_version }}
- run: npm ci
- name: Set up Python 3.10 (macOS only)
if: runner.os == 'macOS'
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Run nexe CD build
run: |
echo "github.ref = ${{ github.ref }}"
./bin/run_cd
env:
NODE_VERSION: ${{ matrix.node_version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CREATE_RELEASE: "${{ github.ref == 'refs/heads/main' && 'true' || 'false' }}"
- name: Get nexe build info
id: build_info
run: |
echo "github.ref = ${{ github.ref }}"
echo "Creating dist/ dir if it doesn't exist ..."
mkdir -p dist/
echo "Getting release_file, release_tag, and release_id ..."
release_file="$(ls dist/ | head -n 1)"
asset_name="$(cat ./NEXE_ASSET_NAME)"
release_tag="$(cat ./RELEASE_TAG)"
release_id="$(cat ./RELEASE_ID)"
echo "Getting build_occurred ..."
if [ "$release_file" != "" ]; then
build_occurred="true"
else
build_occurred="false"
fi
echo "Moving build artifact to asset name ($release_file -> ./$asset_name) ..."
mv "dist/$release_file" "./$asset_name"
echo "release_tag=$release_tag"
echo "release_id=$release_id"
echo "release_file=$release_file"
echo "asset_name=$asset_name"
echo "build_occurred=$build_occurred"
echo "release_tag=$release_tag" >> $GITHUB_OUTPUT
echo "asset_name=$asset_name" >> $GITHUB_OUTPUT
echo "build_occurred=$build_occurred" >> $GITHUB_OUTPUT
# Upload artifact & asset
- name: Upload build artifact
uses: actions/upload-artifact@v4
if: steps.build_info.outputs.build_occurred == 'true'
with:
name: ${{ steps.build_info.outputs.asset_name }}
path: ./${{ steps.build_info.outputs.asset_name }}
- name: Upload Release Asset
uses: softprops/action-gh-release@v2
if: steps.build_info.outputs.build_occurred == 'true' && github.ref == 'refs/heads/main'
with:
fail_on_unmatched_files: true
tag_name: ${{ steps.build_info.outputs.release_tag }}
files: ./${{ steps.build_info.outputs.asset_name }}