Skip to content

Commit

Permalink
Optimize GitHub action (#5)
Browse files Browse the repository at this point in the history
* change action names

* fix indicator issue

* optimize action & descript

* fix theme switcher issue

* fix `jumpTo` issue

* optimized UX

* bump version to v0.9.2

* optimzie github action to get version from tag naem

* update action setting
  • Loading branch information
SYM01 authored May 13, 2024
1 parent 75f88bd commit d6c5b4e
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 5 deletions.
46 changes: 44 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ name: Build Extension
on:
push:
branches:
- main
- main
tags:
- 'v*.*.*'
pull_request:
branches:
- main
- main

env:
CRX_VER: v0.0.0-${{ github.sha }}

jobs:
build:
Expand All @@ -28,6 +33,13 @@ jobs:
- name: Install dependencies
run: npm ci --ignore-scripts

- name: Set version
if: ${{ github.ref_type == 'tag' }}
run: echo "CRX_VER=${{ github.ref_name }}" >> $GITHUB_ENV

- name: Output version
run: echo "Current version ${{ env.CRX_VER }}"

- name: Rebuild the dist directory
run: npm run build

Expand All @@ -36,3 +48,33 @@ jobs:
with:
name: Proxyverse
path: ./dist/

release:
if: ${{ github.ref_type == 'tag' }}
runs-on: ubuntu-latest
needs:
- build

steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: Proxyverse
path: ./dist/

- name: Pack artifact
run: cd ./dist/ && zip -r ../Proxyverse.zip ./

- name: Upload to release page
uses: softprops/action-gh-release@v2
with:
files: ./Proxyverse.zip

- name: Upload to MS Edge
uses: wdzeng/edge-addon@v1
with:
product-id: 6fa97660-6c21-41e4-87e6-06a88509753f
zip-path: ./Proxyverse.zip
client-id: ${{ secrets.EDGE_CLIENT_ID }}
client-secret: ${{ secrets.EDGE_CLIENT_SECRET }}
access-token-url: ${{ secrets.EDGE_ACCESS_TOKEN_URL }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "proxyverse",
"private": true,
"version": "0.9.1",
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProfileConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const chooseRandomeColor = () => {
const profileConfig = reactive<ProfileConfig>({
profileID: props.profileID || crypto.randomUUID(),
color: chooseRandomeColor(),
profileName: props.profileID ? 'Custom Profile' : '',
profileName: props.profileID ? '' : 'Custom Profile',
proxyType: 'proxy',
Expand Down
13 changes: 12 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ if (process.env.npm_lifecycle_event?.endsWith(':test')) {
sourcemap = true
}

const getCRXVersion = () => {
if (process.env.CRX_VER) {
let ver = process.env.CRX_VER
if (ver.startsWith('v')) {
ver = ver.slice(1)
}
return ver.slice(0, 14)
}
return '0.0.0-dev'
}

// https://vitejs.dev/config/
export default defineConfig({
plugins: [
Expand All @@ -21,7 +32,7 @@ export default defineConfig({
generateBundle(outputOption, bundle) {
const entry = Object.values(bundle).find(
(chunk) => chunk.type == 'chunk' && chunk.isEntry && chunk.name == 'background');
manifest.version = process.env.npm_package_version || '0.0.0'
manifest.version = getCRXVersion()
manifest.background.service_worker = (entry as any).fileName

this.emitFile({
Expand Down

0 comments on commit d6c5b4e

Please sign in to comment.