-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- setup tooling for authoring the scaffold - setup github workflows - add dependencies and dotfiles - add README.md
- Loading branch information
0 parents
commit ae795c2
Showing
25 changed files
with
8,292 additions
and
0 deletions.
There are no files selected for viewing
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,4 @@ | ||
demo | ||
dist | ||
scaffold | ||
node_modules |
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,48 @@ | ||
{ | ||
"root": true, | ||
"env": { | ||
"es2021": true, | ||
"node": true | ||
}, | ||
"extends": ["plugin:react/recommended", "standard"], | ||
"parserOptions": { | ||
"ecmaFeatures": { | ||
"jsx": true | ||
}, | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["react"], | ||
"ignorePatterns": [ | ||
"demo", | ||
"dist", | ||
"scaffold", | ||
"node_modules" | ||
], | ||
"rules": { | ||
"func-call-spacing": ["error", "never"], | ||
"quotes": [ | ||
"error", | ||
"double", | ||
{ "avoidEscape": true, "allowTemplateLiterals": false } | ||
], | ||
"space-before-function-paren": [ | ||
"error", | ||
{ "anonymous": "always", "named": "never", "asyncArrow": "always" } | ||
], | ||
"semi": ["error", "always"], | ||
"react/prop-types": [0, {}] | ||
}, | ||
"globals": { | ||
"__DEV__": "readonly", | ||
"FormData": "readonly", | ||
"fetch": "readonly", | ||
"alert": "readonly" | ||
}, | ||
"settings": { | ||
"react": { | ||
"fragment": "Fragment", | ||
"version": "17.0.1" | ||
} | ||
} | ||
} |
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,14 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: "/" | ||
schedule: | ||
interval: weekly | ||
day: sunday | ||
time: "13:00" | ||
open-pull-requests-limit: 10 |
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,26 @@ | ||
## Ticket | ||
|
||
PLAT-XXXX | ||
_Related tickets:_ | ||
_Related PRs:_ | ||
|
||
## Type of PR | ||
|
||
- [ ] Bugfix | ||
- [ ] New feature | ||
- [ ] Minor changes | ||
|
||
Did you make changes to the scaffold? | ||
|
||
- [ ] Yes, and I have read the [scaffold checklist](https://crowdbotics.github.io/modules/scaffold-checklist.html) document and followed the instructions. | ||
- [ ] No. | ||
|
||
## Changes introduced | ||
|
||
_Describe the changes being introduced in this PR_ | ||
_Include screenshots if necessary_ | ||
_Please link any documentation reference that relate to the changes_ | ||
|
||
## Test and review | ||
|
||
_Describe how a reviewer should test your PR_ |
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,66 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
working-directory: ./react-native-scaffold | ||
|
||
steps: | ||
- name: Initialize packages | ||
run: | | ||
sudo apt update | ||
sudo apt install jo git -y | ||
- name: Repo Clone | ||
run: | | ||
git clone https://${{ secrets.GIT_TOKEN }}@github.com/crowdbotics/react-native-scaffold.git | ||
- name: Checkout branch | ||
working-directory: ${{ env.working-directory }} | ||
run: | | ||
echo "branch: ${GITHUB_REF_NAME}" | ||
git checkout ${GITHUB_REF_NAME} | ||
- name: Generate Json data | ||
id: data | ||
working-directory: ${{ env.working-directory }} | ||
run: | | ||
r_version="$(curl -s -H "Authorization:token ${{ secrets.GIT_TOKEN }}" https://api.github.com/repos/$GITHUB_REPOSITORY/tags |jq -r '.[].name' |sort |head -1))" | ||
minor=$(echo $r_version | cut -d'.' -f2) | ||
major=$(echo $r_version | cut -d'.' -f1) | ||
if [ $major == $(date '+%Y%m%d') ]; then | ||
tag_version="$(date '+%Y%m%d').$minor" | ||
echo "release version: $tag_version" | ||
until [ $tag_version != $r_version ]; do | ||
let minor++ | ||
tag_version="$(date '+%Y%m%d').$minor" | ||
echo "final release tag: $tag_version" | ||
done | ||
else | ||
tag_version=$(date '+%Y%m%d').1 | ||
echo "final release tag: $tag_version" | ||
fi | ||
jo -p -- -s tag_name="$tag_version" name="Production Release" body="$(git log --oneline --no-decorate HEAD...$(git tag -l '202[0-9]????.*' --sort=-v:refname | head -n 1))" > data.json | ||
continue-on-error: true | ||
|
||
- name: Json Data Status | ||
if: steps.data.outcome == 'failure' | ||
run: exit 1 | ||
|
||
- name: Add Release Notes | ||
working-directory: ${{ env.working-directory }} | ||
run: | | ||
cat data.json | ||
curl -i -X POST -H "Content-Type:application/json" -H "Authorization:token ${{ secrets.GIT_TOKEN }} " https://api.github.com/repos/$GITHUB_REPOSITORY/releases -d @data.json | ||
- name: Add JIRA Label | ||
working-directory: ${{ env.working-directory }} | ||
run: | | ||
git log --oneline --no-decorate HEAD...$(git tag -l '202[0-9]????.*' --sort=-v:refname | head -n 1) | grep -Eo '([A-Z]{3,}-)([0-9]+)' | uniq > jira_ticket.txt | ||
cat jira_ticket.txt | ||
for i in $(cat jira_ticket.txt); do curl -s -X PUT -H "Content-Type: application/json" -H "Authorization: Basic ${{ secrets.JIRA_TOKEN }}" --data '{"update":{"labels":[{"add":"released"}]}}' https://crowdbotics.atlassian.net/rest/api/3/issue/$i ; done |
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,22 @@ | ||
name: Lint | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
eslint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: "yarn" | ||
- run: yarn install | ||
- uses: crowdbotics/[email protected] | ||
with: | ||
eslint-args: "--config .eslintrc.json --ignore-path=.gitignore --quiet" | ||
extensions: "js,jsx,ts,tsx" | ||
annotations: true |
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,60 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- "[0-9]+.[0-9]+" | ||
|
||
jobs: | ||
set_environment: | ||
outputs: | ||
my_env: ${{ steps.setenv.outputs.my_env }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- id: setenv | ||
run: | | ||
if [ $GITHUB_REF_NAME == master ]; then | ||
echo "my_env=staging" >> $GITHUB_OUTPUT | ||
fi | ||
if [[ $GITHUB_REF_NAME =~ ^[0-9]+\.[0-9]+$ ]]; then | ||
echo "release tag: $GITHUB_REF_NAME" | ||
echo "my_env=production" >> $GITHUB_OUTPUT | ||
fi | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: set_environment | ||
environment: | ||
name: ${{ needs.set_environment.outputs.my_env }} | ||
name: ${{ needs.set_environment.outputs.my_env }}-release | ||
steps: | ||
- name: Generate Heroku Config | ||
run: | | ||
cat <<EOF > ~/.netrc | ||
machine api.heroku.com | ||
login ${{ secrets.HEROKU_EMAIL }} | ||
password ${{ secrets.HEROKU_API_TOKEN }} | ||
machine git.heroku.com | ||
login ${{ secrets.HEROKU_EMAIL }} | ||
password ${{ secrets.HEROKU_API_TOKEN }} | ||
EOF | ||
- name: release scaffold | ||
run: | | ||
heroku config:set REACT_NATIVE_SCAFFOLD_REPO_BRANCH=$GITHUB_REF_NAME -a ${{ secrets.HEROKU_APP }} | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Add JIRA label | ||
run: | | ||
git fetch --tags | ||
git log --oneline --no-decorate HEAD...$(git tag -l '202[0-9]????.*' --sort=-v:refname | head -n 1) | grep -Eo '([A-Z]{3,}-)([0-9]+)' | uniq > jira_ticket.txt | ||
cat jira_ticket.txt | ||
if [ $GITHUB_REF_NAME == master ]; then | ||
for i in $(cat jira_ticket.txt); do curl -X PUT -H "Content-Type: application/json" -H "Authorization: Basic ${{ secrets.JIRA_TOKEN }}" --data '{"update":{"labels":[{"add":"staging"}]}}' https://crowdbotics.atlassian.net/rest/api/3/issue/$i ; done | ||
fi | ||
if [[ $GITHUB_REF_NAME =~ ^[0-9]+\.[0-9]+$ ]]; then | ||
for i in $(cat jira_ticket.txt); do curl -X PUT -H "Content-Type: application/json" -H "Authorization: Basic ${{ secrets.JIRA_TOKEN }}" --data '{"update":{"labels":[{"add":"released"}]}}' https://crowdbotics.atlassian.net/rest/api/3/issue/$i ; done | ||
fi |
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,23 @@ | ||
name: Enforce semver on the scaffold version | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- "scaffold/**" | ||
- "dist/cookie/**" | ||
|
||
jobs: | ||
semver: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: "yarn" | ||
- run: yarn install --immutable | ||
- run: yarn run semver |
Oops, something went wrong.