feat: 1. Update workflow.
2. Add git commit hash
This commit is contained in:
parent
a793cdd512
commit
7c75fa3f51
14
.github/workflows/deploy-pages.yml
vendored
14
.github/workflows/deploy-pages.yml
vendored
@ -47,16 +47,12 @@ jobs:
|
|||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: pnpm run build
|
run: pnpm run build
|
||||||
- name: Setup Pages
|
|
||||||
uses: actions/configure-pages@v3
|
- name: Deploy to gh-pages
|
||||||
- name: Upload artifact
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
uses: actions/upload-pages-artifact@v1
|
|
||||||
with:
|
with:
|
||||||
# Upload dist repository
|
deploy_key: ${{ secrets.GITHUB_TOKEN }}
|
||||||
path: './dist'
|
publish_dir: ./dist
|
||||||
- name: Deploy to GitHub Pages
|
|
||||||
id: deployment
|
|
||||||
uses: actions/deploy-pages@v1
|
|
||||||
|
|
||||||
- name: Sync to Gitee
|
- name: Sync to Gitee
|
||||||
uses: wearerequired/git-mirror-action@master
|
uses: wearerequired/git-mirror-action@master
|
||||||
|
|||||||
2
env.d.ts
vendored
2
env.d.ts
vendored
@ -1,5 +1,7 @@
|
|||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
|
|
||||||
|
declare const LATEST_COMMIT_HASH: string
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Navigator {
|
interface Navigator {
|
||||||
control: any
|
control: any
|
||||||
|
|||||||
@ -65,7 +65,8 @@
|
|||||||
"vite": "^5.1.7",
|
"vite": "^5.1.7",
|
||||||
"vite-plugin-cdn-import": "0.3.5",
|
"vite-plugin-cdn-import": "0.3.5",
|
||||||
"vite-plugin-commonjs": "^0.10.1",
|
"vite-plugin-commonjs": "^0.10.1",
|
||||||
"vue-tsc": "^2.0.6"
|
"vue-tsc": "^2.0.6",
|
||||||
|
"git-last-commit": "^1.0.1"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.{js,ts,vue,jsx,tsx}": [
|
"*.{js,ts,vue,jsx,tsx}": [
|
||||||
|
|||||||
@ -103,6 +103,9 @@ devDependencies:
|
|||||||
eslint-plugin-vue:
|
eslint-plugin-vue:
|
||||||
specifier: ^9.17.0
|
specifier: ^9.17.0
|
||||||
version: 9.24.0(eslint@8.57.0)
|
version: 9.24.0(eslint@8.57.0)
|
||||||
|
git-last-commit:
|
||||||
|
specifier: ^1.0.1
|
||||||
|
version: 1.0.1
|
||||||
husky:
|
husky:
|
||||||
specifier: ^9.0.11
|
specifier: ^9.0.11
|
||||||
version: 9.0.11
|
version: 9.0.11
|
||||||
@ -2465,6 +2468,10 @@ packages:
|
|||||||
engines: {node: '>=16'}
|
engines: {node: '>=16'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/git-last-commit@1.0.1:
|
||||||
|
resolution: {integrity: sha512-FDSgeMqa7GnJDxt/q0AbrxbfeTyxp4ImxEw1e4nw6NUHA5FMhFUq33dTXI4Xdgcj1VQ1q5QLWF6WxFrJ8KCBOg==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/git-raw-commits@4.0.0:
|
/git-raw-commits@4.0.0:
|
||||||
resolution: {integrity: sha512-ICsMM1Wk8xSGMowkOmPrzo2Fgmfo4bMHLNX6ytHjajRJUqvHOw/TFapQ+QG75c3X/tTDDhOSRPGC52dDbNM8FQ==}
|
resolution: {integrity: sha512-ICsMM1Wk8xSGMowkOmPrzo2Fgmfo4bMHLNX6ytHjajRJUqvHOw/TFapQ+QG75c3X/tTDDhOSRPGC52dDbNM8FQ==}
|
||||||
engines: {node: '>=16'}
|
engines: {node: '>=16'}
|
||||||
|
|||||||
20
src/App.vue
20
src/App.vue
@ -6,16 +6,16 @@
|
|||||||
</keep-alive>
|
</keep-alive>
|
||||||
</transition>
|
</transition>
|
||||||
</router-view>
|
</router-view>
|
||||||
<!-- <BaseMask v-if="!isMobile" />-->
|
<BaseMask v-if="!isMobile" />
|
||||||
<!-- <div v-if="!isMobile" class="guide">-->
|
<div v-if="!isMobile" class="guide">
|
||||||
<!-- <Icon icon="mynaui:danger-triangle" />-->
|
<Icon icon="mynaui:danger-triangle" />
|
||||||
<!-- <div class="txt">-->
|
<div class="txt">
|
||||||
<!-- <h2>切换至手机模式才可正常使用</h2>-->
|
<h2>切换至手机模式才可正常使用</h2>
|
||||||
<!-- <h3>1. 按 F12 调出控制台</h3>-->
|
<h3>1. 按 F12 调出控制台</h3>
|
||||||
<!-- <h3>2. 按 Ctrl+Shift+M,或点击下面图标</h3>-->
|
<h3>2. 按 Ctrl+Shift+M,或点击下面图标</h3>
|
||||||
<!-- </div>-->
|
</div>
|
||||||
<!-- <img src="@/assets/img/guide.png" alt="" />-->
|
<img src="@/assets/img/guide.png" alt="" />
|
||||||
<!-- </div>-->
|
</div>
|
||||||
<Call />
|
<Call />
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|||||||
@ -172,18 +172,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="version">抖音 version{{ store.version }}</div>
|
<div class="version">抖音 {{ gitLastCommitHash }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useBaseStore } from '@/store/pinia'
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
const gitLastCommitHash = ref(LATEST_COMMIT_HASH)
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'ChooseSchool'
|
name: 'ChooseSchool'
|
||||||
})
|
})
|
||||||
|
|
||||||
const store = useBaseStore()
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import DefineOptions from 'unplugin-vue-define-options/vite' // 引入插件
|
|||||||
import { Plugin as importToCDN } from 'vite-plugin-cdn-import'
|
import { Plugin as importToCDN } from 'vite-plugin-cdn-import'
|
||||||
import commonjs from 'vite-plugin-commonjs'
|
import commonjs from 'vite-plugin-commonjs'
|
||||||
import { fileURLToPath, URL } from 'node:url'
|
import { fileURLToPath, URL } from 'node:url'
|
||||||
|
import { getLastCommit } from 'git-last-commit'
|
||||||
|
|
||||||
// import viteImagemin from 'vite-plugin-imagemin'
|
// import viteImagemin from 'vite-plugin-imagemin'
|
||||||
// import viteCompression from 'vite-plugin-compression'
|
// import viteCompression from 'vite-plugin-compression'
|
||||||
@ -18,7 +19,12 @@ const lifecycle = process.env.npm_lifecycle_event
|
|||||||
// var: 'axios',
|
// var: 'axios',
|
||||||
// path: 'https://lib.baomitu.com/axios/1.6.8/axios.min.js'
|
// path: 'https://lib.baomitu.com/axios/1.6.8/axios.min.js'
|
||||||
// },
|
// },
|
||||||
export default defineConfig({
|
|
||||||
|
export default defineConfig(async () => {
|
||||||
|
const latestCommitHash = await new Promise<string>((resolve) => {
|
||||||
|
return getLastCommit((err, commit) => (err ? 'unknown' : resolve(commit.shortHash)))
|
||||||
|
})
|
||||||
|
return {
|
||||||
base: './',
|
base: './',
|
||||||
envDir: 'env',
|
envDir: 'env',
|
||||||
plugins: [
|
plugins: [
|
||||||
@ -106,6 +112,11 @@ export default defineConfig({
|
|||||||
// },
|
// },
|
||||||
// }),
|
// }),
|
||||||
],
|
],
|
||||||
|
define: {
|
||||||
|
LATEST_COMMIT_HASH: JSON.stringify(
|
||||||
|
latestCommitHash + (process.env.NODE_ENV === 'production' ? '' : ' (dev)')
|
||||||
|
)
|
||||||
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||||
@ -176,4 +187,5 @@ export default defineConfig({
|
|||||||
strict: false
|
strict: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user