Merge pull request #16 from biplobsd/svelte-5-upgrading #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Package | |
on: | |
push: | |
branches: | |
- main | |
- svelte-5-upgrading | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
browser_name: [ chrome, firefox ] | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
# Step 2: Set up Node.js | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 22.13.0 # Use a version compatible with your dependencies | |
cache: 'npm' | |
# Step 3: Install dependencies | |
- name: Install Dependencies | |
run: npm install | |
# Step 4: Build for the current environment | |
- name: Build for ${{ matrix.browser_name }} | |
env: | |
VITE_BROWSER_NAME: ${{ matrix.browser_name }} | |
VITE_API_KEY: ${{ secrets.VITE_API_KEY }} | |
run: npm run build | |
# Step 5: Package the build and set output | |
- name: Package Build | |
id: package | |
run: | | |
VERSION=$(node -p "require('./package.json').version") | |
OUTPUT_NAME="yst_v${VERSION}_${{ matrix.browser_name }}" | |
echo "output_name=${OUTPUT_NAME}" >> $GITHUB_ENV | |
shell: bash | |
# Step 6: Upload artifacts | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.output_name }} | |
path: ./dist/** |