Skip to content

Commit

Permalink
Merge pull request #168 from KennyOliver/issue-154
Browse files Browse the repository at this point in the history
Issue 154
  • Loading branch information
KennyOliver authored Jan 3, 2025
2 parents b6d0573 + e4d722d commit 688767d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 43 deletions.
61 changes: 24 additions & 37 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,24 @@ name: Build & Release FlavorLang

on:
push:
branches:
- main
branches: [main]
pull_request:
branches:
- main
branches: [main]
release:
types: [created]

jobs:
build:
name: Build FlavorLang & VS Code Extension
name: Build FlavorLang
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: 20

Expand All @@ -33,60 +29,51 @@ jobs:
npm ci
npm audit fix --force || true
npx @vscode/vsce package
mv *.vsix flavorlang-extension-${{ matrix.os }}.vsix
- name: Build FlavorLang interpreter
working-directory: src
run: make

- name: Rename FlavorLang interpreter
run: mv src/flavor src/flavorlang-${{ matrix.os }}
- name: Prepare release package
run: |
# Create staging directory
mkdir -p staging
# Make interpreter executable
- name: Make interpreter executable
run: chmod +x src/flavorlang-${{ matrix.os }}
# Copy and rename files
cp vscode-extension/*.vsix staging/flavorlang-extension-${{ matrix.os }}.vsix
cp src/flavor staging/flavor
chmod +x staging/flavor
# Copy the appropriate install.sh script
- name: Copy install.sh
run: |
# Copy appropriate install script
if [[ "${{ matrix.os }}" == "macos-latest" ]]; then
cp scripts/install_macos.sh install.sh
elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
cp scripts/install_ubuntu.sh install.sh
cp scripts/install_macos.sh staging/install.sh
else
cp scripts/install_ubuntu.sh staging/install.sh
fi
chmod +x staging/install.sh
# Package interpreter, VSIX, and install.sh into a ZIP
- name: Package release assets
run: |
zip -r flavorlang-${{ matrix.os }}.zip flavorlang-${{ matrix.os }} flavorlang-extension-${{ matrix.os }}.vsix install.sh
# Create ZIP
cd staging
zip -r ../flavorlang-${{ matrix.os }}.zip ./*
# Upload the ZIP as an artifact
- name: Upload release package
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: flavorlang-${{ matrix.os }}
path: flavorlang-${{ matrix.os }}.zip

release:
name: Attach Artifacts to Release
needs: build
if: github.event_name == 'release'
runs-on: ubuntu-latest

steps:
- name: Download all artifacts
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts

# Debug step to verify file structure
- name: Debug file structure
run: |
echo "Contents of artifacts directory:"
ls -R ./artifacts
find ./artifacts -type f
- name: Upload release artifacts
- name: Upload to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v1
Expand Down
15 changes: 12 additions & 3 deletions scripts/install_macos.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
#!/bin/bash

# Exit immediately if a command exits with a non-zero status
set -e

# Rename file to flavorlang
echo "Renaming flavorlang-macos-latest to flavorlang"
mv flavorlang-macos-latest flavorlang

# Set execute permissions
chmod +x flavorlang-macos-latest
chmod +x flavorlang

# Move to /usr/local/bin for easier access
sudo mv flavorlang-macos-latest /usr/local/bin/
echo "Moving flavorlang to /usr/local/bin/"
sudo mv flavorlang /usr/local/bin/

# Run the executable
flavorlang-macos-latest --about
echo "Running FlavorLang interpreter..."
flavorlang --about
15 changes: 12 additions & 3 deletions scripts/install_ubuntu.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
#!/bin/bash

# Exit immediately if a command exits with a non-zero status
set -e

# Rename file to flavorlang
echo "Renaming flavorlang-ubuntu-latest to flavorlang"
mv flavorlang-ubuntu-latest flavorlang

# Set execute permissions
chmod +x flavorlang-ubuntu-latest
chmod +x flavorlang

# Move to /usr/local/bin for easier access
sudo mv flavorlang-ubuntu-latest /usr/local/bin/
echo "Moving flavorlang to /usr/local/bin/"
sudo mv flavorlang /usr/local/bin/

# Run the executable
flavorlang-ubuntu-latest --about
echo "Running FlavorLang interpreter..."
flavorlang --about

0 comments on commit 688767d

Please sign in to comment.