Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Build & Release
#
# Builds the Chrome extension, packages artifacts,
# and creates a GitHub Release when a version tag is pushed.
#
# Triggers:
# push to main → build + upload artifacts (CI validation)
# pull_request → build only (validation)
# tag v* → build + package + GitHub Release
#
# Artifacts produced:
# Chrome: cstradeup-v{ver}-chrome.zip

name: Build & Release

on:
push:
branches: [main]
tags: ["v*"]

# Cancel in-progress runs for the same branch/PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# ─────────────────────────────────────────────────────────────────────────
# Build: Chrome only (production)
# ─────────────────────────────────────────────────────────────────────────
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
browser: [chrome]

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

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build (${{ matrix.browser }}, production)
run: pnpm build:${{ matrix.browser }}

- name: Package extension
run: pnpm package:${{ matrix.browser }}
env:
SKIP_CRX: '1'

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.browser }}-build
path: dist/
if-no-files-found: error
retention-days: 30

- name: Upload unpacked build
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.browser }}-unpacked
path: build/
if-no-files-found: error
retention-days: 14

# ─────────────────────────────────────────────────────────────────────────
# Release: triggered only on version tags (v*)
# ─────────────────────────────────────────────────────────────────────────
release:
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write

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

- name: Download Chrome artifacts
uses: actions/download-artifact@v4
with:
name: chrome-build
path: release/chrome

- name: List release artifacts
run: find release/ -type f | sort

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
draft: false
prerelease: ${{ contains(github.ref_name, '-') }}
files: |
release/chrome/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 changes: 17 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cstradeup-extension",
"version": "0.1.0",
"version": "0.2.0",
"description": "Analyze your CS2 inventory for profitable trade ups. View hidden skins in your Storage Units and other inventory insights.",
"license": "MIT",
"directories": {
Expand All @@ -11,13 +11,24 @@
"url": "git+https://github.com/cstradeup/extension.git"
},
"scripts": {
"clean": "node -e \"require('fs').rmSync('./build', { recursive: true, force: true })\"",
"clean": "node -e \"require('fs').rmSync('./build', { recursive: true, force: true }); require('fs').rmSync('./dist', { recursive: true, force: true })\"",
"build:ts": "tsc",
"build:css": "tailwindcss -i src/styles/tailwind.css -o styles.css --minify",
"watch:css": "tailwindcss -i src/styles/tailwind.css -o styles.css --watch",
"build:webpack": "npm run build:css && NODE_ENV=production webpack --config webpack.config.js",
"build:webpack:dev": "npm run build:css && NODE_ENV=development webpack --config webpack.config.js",
"build:chrome": "BROWSER=chrome npm run build:webpack",
"build:firefox": "BROWSER=firefox npm run build:webpack",
"build:chrome:dev": "BROWSER=chrome npm run build:webpack:dev",
"build:firefox:dev": "BROWSER=firefox npm run build:webpack:dev",
"build:all": "npm run build:chrome && npm run package:chrome && npm run clean:build && npm run build:firefox && npm run package:firefox",
"clean:build": "node -e \"require('fs').rmSync('./build', { recursive: true, force: true })\"",
"dev": "npm run build:webpack:dev",
"dev:chrome": "npm run build:chrome:dev",
"dev:firefox": "npm run build:firefox:dev",
"package": "node scripts/package-extension.js",
"package:chrome": "BROWSER=chrome node scripts/package-extension.js",
"package:firefox": "BROWSER=firefox node scripts/package-extension.js",
"zip": "cd build && zip -r ../extension.zip . && echo 'Created extension.zip'"
},
"homepage": "https://github.com/cstradeup/extension#readme",
Expand All @@ -26,6 +37,7 @@
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@tailwindcss/cli": "^4.2.2",
"@types/chrome": "^0.1.28",
"@types/firefox-webext-browser": "^120.0.4",
"@types/node": "^20.4.10",
Expand All @@ -40,6 +52,7 @@
"buffer": "^6.0.3",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^11.0.0",
"crx3": "^1.1.3",
"css-loader": "^6.7.3",
"daisyui": "^5.5.5",
"file-loader": "^6.2.0",
Expand All @@ -50,7 +63,7 @@
"postcss": "^8.5.6",
"process": "^0.11.10",
"stream-browserify": "^3.0.0",
"tailwindcss": "^4.1.17",
"tailwindcss": "^4.2.2",
"terser-webpack-plugin": "^5.3.6",
"ts-loader": "^9.4.2",
"type-fest": "^3.5.2",
Expand All @@ -67,6 +80,5 @@
"comlink": "^4.4.2",
"tlsn-js": "0.1.0-alpha.12.0"
},
"overrides": {
}
"overrides": {}
}
Loading