Skip to content

Commit

Permalink
Updating expo to version 52, making text selectable, auto set changel…
Browse files Browse the repository at this point in the history
…og date (#356)
  • Loading branch information
Thomas-Gallant authored Dec 11, 2024
1 parent 5f200e9 commit 807c5aa
Show file tree
Hide file tree
Showing 13 changed files with 12,052 additions and 15,420 deletions.
618 changes: 618 additions & 0 deletions .github/scripts/package-lock.json

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions .github/scripts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "scripts",
"version": "1.0.0",
"main": "get-current-date.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"@qetza/replacetokens": "^1.8.0",
"bun": "^1.1.38"
}
}
50 changes: 50 additions & 0 deletions .github/scripts/set-changelog-date.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { $ } from "bun";
import { replaceTokens } from '@qetza/replacetokens';
import changelog from "../../sudokuru/Changelog.json";

function getDaySuffix(day) {
if (day >= 11 && day <= 13) {
return "th";
}
switch (day % 10) {
case 1:
return "st";
case 2:
return "nd";
case 3:
return "rd";
default:
return "th";
}
}

const utcDate = new Date().toLocaleString("en-US", { timeZone: 'America/New_York' });
const date = new Date(utcDate);
const monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
const day = date.getDate();
console.log(utcDate);
const suffix = getDaySuffix(day);
const formattedDate = `${monthNames[date.getMonth()]} ${day}${suffix}, ${date.getFullYear()}`;
console.log(formattedDate);

const firstDate = changelog[0].date;
const isFirstDateReplaced = firstDate === "#{date}#";

const vars = { DATE: formattedDate };

const result = await replaceTokens(
['**/Changelog.json'],
(name) => vars[name],
);

if(result.replaced > 1) {
const errorMessage = "Changelog.json file has multiple dates replaced!";
await $`echo "::error file=sudokuru/changelog.json,title=INVALID-CHANGELOG::${errorMessage}"`;
throw new Error(errorMessage);
}

if(!isFirstDateReplaced && result.replaced >= 1) {
const errorMessage = "Changelog.json file has incorrect #{date}# configuration!";
await $`echo "::error file=sudokuru/changelog.json,title=INVALID-CHANGELOG::${errorMessage}"`;
throw new Error(errorMessage);
}
13 changes: 13 additions & 0 deletions .github/workflows/composite-actions/set-changelog-date/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Set Changelog Date
description: Sets changelog date in changelog.json

runs:
using: composite
steps:
- name: Install script dependencies
shell: bash
working-directory: .github/scripts
run: npm i
- name: Update Changelog Date
shell: bash
run: npx bun ./.github/scripts/set-changelog-date.js
14 changes: 14 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ jobs:
run: |
npm i [email protected]
npx prettier --check .
- name: Setup Changelog
uses: ./.github/workflows/composite-actions/set-changelog-date
- name: Typescript Check
working-directory: sudokuru
run: npx tsc
Expand All @@ -87,6 +89,8 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Setup Changelog
uses: ./.github/workflows/composite-actions/set-changelog-date
- name: 🏗 Setup Expo
uses: expo/expo-github-action@v8
with:
Expand Down Expand Up @@ -126,6 +130,8 @@ jobs:
node-version: 18.x
- name: install dependencies
run: npm i
- name: Setup Changelog
uses: ./.github/workflows/composite-actions/set-changelog-date
- uses: JarvusInnovations/background-action@v1
name: Bootstrap System Under Test (SUT)
with:
Expand Down Expand Up @@ -173,6 +179,8 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Setup Changelog
uses: ./.github/workflows/composite-actions/set-changelog-date
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
Expand Down Expand Up @@ -209,6 +217,8 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18
- name: Setup Changelog
uses: ./.github/workflows/composite-actions/set-changelog-date
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: install ubuntu dependencies
Expand Down Expand Up @@ -289,6 +299,8 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- run: npm ci
- name: Setup Changelog
uses: ./.github/workflows/composite-actions/set-changelog-date
- name: Cloudflare dev preview deployment
id: deployment
uses: ./.github/workflows/composite-actions/cloudflare-deployment
Expand All @@ -306,6 +318,8 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- run: npm ci
- name: Setup Changelog
uses: ./.github/workflows/composite-actions/set-changelog-date
- name: Cloudflare dev preview deployment
id: deployment
uses: ./.github/workflows/composite-actions/cloudflare-deployment
Expand Down
Loading

0 comments on commit 807c5aa

Please sign in to comment.