Skip to content

Commit

Permalink
fix: release scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jog1t committed Jan 22, 2025
1 parent d83ab10 commit 02d4ab7
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 35 deletions.
File renamed without changes.
17 changes: 10 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,16 @@ jobs:
id-token: write
steps:
- uses: actions/checkout@v4

with:
lfs: 'true'
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: '22'
node-version: 20
cache: "yarn"

- name: Install dependencies
run: yarn install

- name: Setup
env:
Expand All @@ -48,16 +54,13 @@ jobs:
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Setup Corepack
corepack enable
# Install Deno
curl -fsSL https://deno.land/x/install/install.sh | sh
export PATH=$HOME/.deno/bin:$PATH
# Authenticate NPM
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
echo "@rivet-gg:registry=https://registry.npmjs.org/" >> ~/.npmrc
yarn config set 'npmRegistries["//registry.npmjs.org"].npmAuthToken' ${{ secrets.NPM_TOKEN }}
yarn config set 'npmScopes["@rivet-gg"].npmPublishRegistry' https://registry.npmjs.org/
if [ "${{ inputs.latest }}" = "true" ]; then
./scripts/release/main.ts --version "${{ github.event.inputs.version }}" --setup
Expand Down
4 changes: 2 additions & 2 deletions frontend/apps/hub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"@rivet-gg/actor-client": "workspace:*",
"@rivet-gg/actor-common": "workspace:^",
"@rivet-gg/actor-protocol": "workspace:*",
"@rivet-gg/api": "file:vendor/rivet-gg-api.tgz",
"@rivet-gg/api-ee": "file:vendor/rivet-gg-api-ee.tgz",
"@rivet-gg/api": "file:./vendor/rivet-gg-api.tgz",
"@rivet-gg/api-ee": "file:./vendor/rivet-gg-api-ee.tgz",
"@rivet-gg/components": "workspace:*",
"@rivet-gg/icons": "workspace:*",
"@sentry/react": "^8.26.0",
Expand Down
2 changes: 1 addition & 1 deletion frontend/packages/icons/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
*.gen.*
src/*
!src/package.json
dist
36 changes: 26 additions & 10 deletions frontend/packages/icons/scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ const packageExistsOptions = {
],
};

const sourceDir = join(__dirname, "..", "src");

if (!fs.existsSync(sourceDir)){
fs.mkdirSync(sourceDir, { recursive: true });
}

if (process.env.FONTAWESOME_PACKAGE_TOKEN) {
fs.writeFileSync(
"./src/.yarnrc.yml",
join(sourceDir, ".yarnrc.yml"),
dedent`
nodeLinker: node-modules
Expand All @@ -33,20 +39,30 @@ if (process.env.FONTAWESOME_PACKAGE_TOKEN) {
`,
);

fs.writeFileSync("./src/yarn.lock", "");
fs.writeFileSync(join(sourceDir, "./package.json"), JSON.stringify({
"name": "@rivet-gg/internal-icons",
"private": true,
"dependencies": {
"@awesome.me/kit-63db24046b": "^1.0.11",
"@fortawesome/pro-regular-svg-icons": "6.6.0",
"@fortawesome/pro-solid-svg-icons": "6.6.0"
}
}));

fs.writeFileSync(join(sourceDir, "yarn.lock"), "");

spawnSync(
"yarn",
["config", "set", "-H", "enableImmutableInstalls", "false"],
{
stdio: "inherit",
cwd: join(process.cwd(), "src"),
cwd: sourceDir,
},
);

spawnSync("yarn", [], {
stdio: "inherit",
cwd: join(process.cwd(), "src"),
cwd: sourceDir,
env: {
...process.env,
CI: 0,
Expand Down Expand Up @@ -77,8 +93,8 @@ let indexTsSource = dedent`
`;

for (const [pkg, { icons }] of Object.entries(manifest)) {
const pkgExists = pkg.includes("pro") ? isPro : true;
const isCustom = pkg.startsWith("@awesome.me/kit-");
const pkgExists = (pkg.includes("pro") || isCustom) ? isPro : true;

if (isCustom) {
if (!pkgExists) {
Expand Down Expand Up @@ -112,14 +128,14 @@ for (const [pkg, { icons }] of Object.entries(manifest)) {
}
}
}
fs.writeFileSync("src/index.gen.ts", `${indexTsSource}`);
fs.writeFileSync(join(sourceDir, "index.gen.ts"), `${indexTsSource}`);

let iconsPackTsSource = `${banner}\n
import {type IconPack} from "@fortawesome/fontawesome-common-types";\n`;

for (const [pkg, { icons }] of Object.entries(manifest)) {
const pkgExists = pkg.includes("pro") ? isPro : true;
const isCustom = pkg.startsWith("@awesome.me/kit-");
const pkgExists = (pkg.includes("pro")||isCustom) ? isPro : true;

if (isCustom) {
const iconNames = icons.map(({ icon }) => icon);
Expand Down Expand Up @@ -169,20 +185,20 @@ for (const [pkg, { icons }] of Object.entries(manifest)) {

iconsPackTsSource += "} as IconPack;\n";

fs.writeFileSync("src/icons-pack.gen.ts", `${iconsPackTsSource}`);
fs.writeFileSync(join(__dirname, "../src/icons-pack.gen.ts"), `${iconsPackTsSource}`);

async function build() {
await vite.build({
plugins: [],
root: resolve(__dirname, "./src"),
root: resolve(sourceDir),
build: {
outDir: resolve(__dirname, "../dist"),
emptyOutDir: true,
minify: true,
lib: {
name: "icons",
entry: {
index: resolve(__dirname, "../src/index.gen.ts"),
index: resolve(sourceDir, "index.gen.ts"),
},
},
rollupOptions: {
Expand Down
9 changes: 0 additions & 9 deletions frontend/packages/icons/src/package.json

This file was deleted.

12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3096,9 +3096,9 @@ __metadata:
languageName: unknown
linkType: soft

"@rivet-gg/api-ee@file:vendor/rivet-gg-api-ee.tgz::locator=%40rivet-gg%2Fhub%40workspace%3Afrontend%2Fapps%2Fhub":
"@rivet-gg/api-ee@file:./vendor/rivet-gg-api-ee.tgz::locator=%40rivet-gg%2Fhub%40workspace%3Afrontend%2Fapps%2Fhub":
version: 0.0.1
resolution: "@rivet-gg/api-ee@file:vendor/rivet-gg-api-ee.tgz#vendor/rivet-gg-api-ee.tgz::hash=1f46df&locator=%40rivet-gg%2Fhub%40workspace%3Afrontend%2Fapps%2Fhub"
resolution: "@rivet-gg/api-ee@file:./vendor/rivet-gg-api-ee.tgz#./vendor/rivet-gg-api-ee.tgz::hash=1f46df&locator=%40rivet-gg%2Fhub%40workspace%3Afrontend%2Fapps%2Fhub"
dependencies:
form-data: "npm:^4.0.0"
js-base64: "npm:^3.7.5"
Expand All @@ -3109,9 +3109,9 @@ __metadata:
languageName: node
linkType: hard

"@rivet-gg/api@file:vendor/rivet-gg-api.tgz::locator=%40rivet-gg%2Fhub%40workspace%3Afrontend%2Fapps%2Fhub":
"@rivet-gg/api@file:./vendor/rivet-gg-api.tgz::locator=%40rivet-gg%2Fhub%40workspace%3Afrontend%2Fapps%2Fhub":
version: 24.1.0
resolution: "@rivet-gg/api@file:vendor/rivet-gg-api.tgz#vendor/rivet-gg-api.tgz::hash=46b44b&locator=%40rivet-gg%2Fhub%40workspace%3Afrontend%2Fapps%2Fhub"
resolution: "@rivet-gg/api@file:./vendor/rivet-gg-api.tgz#./vendor/rivet-gg-api.tgz::hash=46b44b&locator=%40rivet-gg%2Fhub%40workspace%3Afrontend%2Fapps%2Fhub"
dependencies:
form-data: "npm:^4.0.0"
js-base64: "npm:^3.7.5"
Expand Down Expand Up @@ -3221,8 +3221,8 @@ __metadata:
"@rivet-gg/actor-client": "workspace:*"
"@rivet-gg/actor-common": "workspace:^"
"@rivet-gg/actor-protocol": "workspace:*"
"@rivet-gg/api": "file:vendor/rivet-gg-api.tgz"
"@rivet-gg/api-ee": "file:vendor/rivet-gg-api-ee.tgz"
"@rivet-gg/api": "file:./vendor/rivet-gg-api.tgz"
"@rivet-gg/api-ee": "file:./vendor/rivet-gg-api-ee.tgz"
"@rivet-gg/components": "workspace:*"
"@rivet-gg/icons": "workspace:*"
"@sentry/react": "npm:^8.26.0"
Expand Down

0 comments on commit 02d4ab7

Please sign in to comment.