-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating expo to version 52, making text selectable, auto set changel…
…og date (#356)
- Loading branch information
1 parent
5f200e9
commit 807c5aa
Showing
13 changed files
with
12,052 additions
and
15,420 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -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" | ||
} | ||
} |
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 |
---|---|---|
@@ -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
13
.github/workflows/composite-actions/set-changelog-date/action.yml
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 |
---|---|---|
@@ -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 |
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 |
---|---|---|
|
@@ -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 | ||
|
@@ -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: | ||
|
@@ -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: | ||
|
@@ -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' | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
Oops, something went wrong.