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