-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: git info and ci preview (#33)
- Loading branch information
1 parent
41a04b9
commit 0b4e492
Showing
5 changed files
with
189 additions
and
15 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,22 +2,11 @@ name: Publish Demo | |
env: | ||
CI: true | ||
FORCE_COLOR: 1 | ||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- 'examples/demo/**' | ||
- '.github/workflows/publish-demo.yml' | ||
- 'pnpm-lock.yaml' | ||
pull_request: | ||
paths: | ||
- 'packages/demo/**' | ||
- '.github/workflows/publish-demo.yml' | ||
- 'pnpm-lock.yaml' | ||
on: [push] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
if: github.ref_name == 'master' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: pnpm/[email protected] | ||
|
@@ -29,7 +18,48 @@ jobs: | |
cache: 'pnpm' | ||
- run: pnpm install | ||
- run: pnpm -r --filter demo run build | ||
- uses: fission-suite/[email protected] | ||
- uses: fission-suite/publish-action@feat/cid-output | ||
id: fission | ||
with: | ||
machine_key: ${{ secrets.FISSION_MACHINE_KEY }} | ||
workdir: 'examples/demo' | ||
- name: Add url to GITHUB_STEP_SUMMARY | ||
run: | | ||
echo " | ||
### App URL 🌐 | ||
https://dweb.link/ipfs/${{ steps.fission.outputs.app_cid }} | ||
" >> $GITHUB_STEP_SUMMARY | ||
preview: | ||
runs-on: ubuntu-latest | ||
if: github.ref_name != 'master' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: pnpm/[email protected] | ||
with: | ||
version: 8 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: 'pnpm' | ||
- run: pnpm install | ||
- run: pnpm -r --filter demo run build | ||
env: | ||
GITHUB_WORKFLOW_ID: ${{ github.run_id }} | ||
- name: Add report to web3.storage | ||
uses: web3-storage/add-to-web3@v2 | ||
id: add_to_web3_storage | ||
with: | ||
path_to_add: examples/demo/dist | ||
web3_token: ${{ secrets.WEB3_TOKEN }} | ||
- name: Add url to GITHUB_STEP_SUMMARY | ||
run: | | ||
echo " | ||
### Preview URL 🌐 | ||
${{ steps.add_to_web3_storage.outputs.url }} | ||
" >> $GITHUB_STEP_SUMMARY | ||
- uses: mshick/add-pr-comment@v2 | ||
with: | ||
message-id: 'preview-url' | ||
message: | | ||
### Preview URL 🌐 | ||
${{ steps.add_to_web3_storage.outputs.url }} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,19 @@ | ||
import { defineConfig } from 'vite' | ||
import preact from '@preact/preset-vite' | ||
import * as child from 'child_process' | ||
import * as git from 'tiny-git-rev-sync' | ||
|
||
const commitHash = child.execSync('git rev-parse HEAD').toString() | ||
|
||
export default defineConfig({ | ||
define: { | ||
'import.meta.env.GIT_COMMIT_HASH': JSON.stringify(commitHash), | ||
'import.meta.env.GIT_BRANCH': JSON.stringify(git.gitBranch()), | ||
'import.meta.env.GIT_DATE': JSON.stringify(git.gitDate()), | ||
'import.meta.env.GIT_TAG': JSON.stringify(git.gitTag()), | ||
'import.meta.env.GITHUB_WORKFLOW_ID': JSON.stringify( | ||
process.env.GITHUB_WORKFLOW_ID | ||
), | ||
}, | ||
plugins: [preact()], | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.