Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tooling-ci): Improved explorer release process #3812

Merged
merged 16 commits into from
Nov 4, 2024
Merged
6 changes: 3 additions & 3 deletions .github/workflows/_vercel_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ jobs:
with:
isProd: false

explorer-prod:
name: Vercel Explorer Production
explorer-staging:
name: Vercel Explorer Staging
if: inputs.isDevelop
uses: ./.github/workflows/apps_explorer_deploy.yml
secrets: inherit
with:
isProd: true
isStaging: true

ui-kit-preview:
name: Vercel UI Kit Preview
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/apps_explorer_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,25 @@ name: Deploy for Explorer
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.EXPLORER_VERCEL_PROJECT_ID }}
EXPLORER_VERCEL_PROJECT_STAGING_URL: ${{ EXPLORER_VERCEL_PROJECT_STAGING_URL }}

on:
workflow_dispatch:
inputs:
isProd:
type: boolean
required: true
isStaging:
type: boolean
required: true
workflow_call:
inputs:
isProd:
type: boolean
required: true
isStaging:
type: boolean
required: true

jobs:
deploy:
Expand Down Expand Up @@ -64,6 +75,9 @@ jobs:
id: deploy_url
if: ${{ inputs.isProd == false }}
run: echo "DEPLOY_URL=$(cat vercel_output.txt | awk 'END{print}')" >> $GITHUB_OUTPUT
- name: Alias Staging deploy
if: ${{ inputs.isStaging }}
run: vercel alias ${{ steps.deploy_url.outputs.DEPLOY_URL }} $EXPLORER_VERCEL_PROJECT_STAGING_URL
- name: Comment on pull request
if: ${{ inputs.isProd == false }}
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # pin@v7
Expand Down
15 changes: 15 additions & 0 deletions apps/explorer/git-rev.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { execSync } from 'child_process';
import fs from 'fs';

// Get the current git commit hash
const commitHash = execSync('git rev-parse HEAD').toString().trim();
console.log(`Current commit hash: ${commitHash}`);

// Save the commit hash to a file
const filePath = './rev.json'
fs.writeFileSync(filePath, JSON.stringify({
rev: commitHash
}));

console.log(`Commit hash saved to ${filePath}`);

7 changes: 4 additions & 3 deletions apps/explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"name": "iota-explorer",
"private": true,
"scripts": {
"dev": "vite --port 3000",
"dev": "pnpm generate-rev && vite --port 3000",
"test": "pnpm test:unit",
"test:unit": "vitest run",
"typecheck": "tsc -b",
"playwright": "playwright",
"build": "pnpm typecheck && vite build",
"build": "pnpm generate-rev && pnpm typecheck && vite build",
"eslint:check": "eslint --max-warnings=0 \"./src/**/*.{js,jsx,ts,tsx}\"",
"eslint:fix": "pnpm eslint:check --fix",
"prettier:check": "prettier -c --ignore-unknown --ignore-path=../../.prettierignore --ignore-path=.prettierignore .",
Expand All @@ -16,7 +16,8 @@
"lint:fix": "pnpm eslint:fix && pnpm prettier:fix",
"preview": "vite preview",
"ampli": "ampli",
"pull-amplitude": "ampli pull web && node prependLicense.mjs && prettier -w ampli.json src/utils/analytics/ampli/index.ts"
"pull-amplitude": "ampli pull web && node prependLicense.mjs && prettier -w ampli.json src/utils/analytics/ampli/index.ts",
"generate-rev": "node git-rev.mjs"
},
"dependencies": {
"@amplitude/analytics-browser": "^1.10.3",
Expand Down
1 change: 1 addition & 0 deletions apps/explorer/rev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rev":"aa9dcbe20c8af383b04f64cd5895c79b4610f038"}
begonaalvarezd marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions apps/explorer/src/components/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { LegalLinks, LegalText } from './Legal';
import { IotaLogoWeb } from '@iota/ui-icons';
import { Link } from '~/components/ui';
import { FOOTER_LINKS } from '~/lib/constants';
import { rev } from '~/../rev.json'

function FooterLinks(): JSX.Element {
return (
Expand Down Expand Up @@ -45,6 +46,7 @@ function Footer(): JSX.Element {
<div className="mt-4 flex justify-center pt-5 text-neutral-10 md:hidden md:self-start">
<IotaLogoWeb width={137} height={36} />
</div>
<p className="text-neutral-40 text-center w-full p-8">{rev}</p>
begonaalvarezd marked this conversation as resolved.
Show resolved Hide resolved
</footer>
);
}
Expand Down