Skip to content

Commit

Permalink
Set repository name in links based on env variable
Browse files Browse the repository at this point in the history
So that links work after transferring the repository.
  • Loading branch information
austinEng committed Feb 17, 2023
1 parent 037a2c5 commit db76461
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:

- name: Install and Build 🔧
run: |
export REPOSITORY_NAME=${{ github.repository }}
npm ci
npm run-script lint
npm run-script build
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:

- name: Install and Build 🔧
run: |
export REPOSITORY_NAME=${{ github.repository }}
npm ci
npm run-script lint
npm run-script build
Expand Down
3 changes: 3 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,7 @@ module.exports = {

return config;
},
env: {
REPOSITORY_NAME: process.env.REPOSITORY_NAME,
},
}
2 changes: 1 addition & 1 deletion src/components/SampleLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ const SampleLayout: React.FunctionComponent<
<a
target="_blank"
rel="noreferrer"
href={`https://github.com/austinEng/webgpu-samples/tree/main/${props.filename}`}
href={`https://github.com/${process.env.REPOSITORY_NAME}/tree/main/${props.filename}`}
>
See it on Github!
</a>
Expand Down
4 changes: 3 additions & 1 deletion src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ const MainLayout: React.FunctionComponent<AppProps> = ({
></div>
</h1>
<div className={styles.panelContents}>
<a href="https://github.com/austinEng/webgpu-samples">Github</a>
<a href={`https://github.com/${process.env.REPOSITORY_NAME}`}>
Github
</a>
<hr />
<ul className={styles.exampleList}>
{samplesNames.map((slug) => {
Expand Down

0 comments on commit db76461

Please sign in to comment.