Skip to content

Commit

Permalink
feat(git-tools): Added reusable GitHub workflows and actions
Browse files Browse the repository at this point in the history
  • Loading branch information
sullivanpj committed Apr 6, 2024
1 parent f9cf757 commit 1c9a539
Show file tree
Hide file tree
Showing 62 changed files with 11,594 additions and 5,326 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ DEFAULT_TIMEZONE="America/New_York"

# STORM_OWNER="sullivanpj"
# STORM_CI=true
# STORM_WORKER="stormie-bot"
# STORM_BOT="stormie-bot"
# STORM_ORGANIZATION="storm-software"
# STORM_NAMESPACE="storm-software"
# STORM_REPOSITORY="https://github.com/storm-software/storm-ops"
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
**/Thumbs.db/**
**/.tamagui*
**/.next*
**/CODEOWNERS
61 changes: 0 additions & 61 deletions .eslintrc.json

This file was deleted.

4 changes: 3 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
* @sullivanpj
- @sullivanpj

/docs/ @storm-software/docs
40 changes: 0 additions & 40 deletions .github/actions/setup-workspace/action.yaml

This file was deleted.

106 changes: 106 additions & 0 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Note: This is a composite GitHub Actions, it should do all env setup, caching an so on, so other pipelines can just compose their own stuff on top of that.
# Docs: https://docs.github.com/en/actions/creating-actions/creating-a-composite-action

name: "Setup Action"
description: "A composite action configuration used across many Storm Software repos to setup: checkout, Node.js, a package manager, and npm registry configuration."
inputs:
workingDirectory:
description: "The working directory of your node package"
required: false
default: ./
packageManager:
description: Package manager
required: false
default: pnpm
packageManagerVersion:
description: Package manager version
required: false
default: 8.10.2
stormBot:
description: The github username of the Storm bot
required: false
default: ""

runs:
using: "composite"
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
continue-on-error: true
with:
access_token: ${{ github.token }}

- name: Check pnpm version
shell: bash
id: pnpm
if: inputs.packageManager == 'pnpm'
working-directory: ${{ inputs.workingDirectory }}
run: |
PNPM_VERSION=${PNPM_VERSION:-7.30.5}
PKG_JSON=$(cat package.json | jq -r '.packageManager' | awk -F@ '{print $2}')
if [ ! -z $PKG_JSON ]; then
PNPM_VERSION=$PKG_JSON
fi
if [ ! -z {{inputs.packageManager}} ]; then
PNPM_VERSION=${{ inputs.packageManagerVersion }}
fi
echo "Using PNPM version $PNPM_VERSION"
echo "version=$PNPM_VERSION" >> $GITHUB_OUTPUT
- name: Setup ${{ inputs.packageManager }}
id: pnpm_setup
if: inputs.packageManager == 'pnpm'
uses: pnpm/action-setup@v3.0.0
with:
version: ${{ steps.pnpm.outputs.version }}
run_install: false
package_json_file: ${{ inputs.workingDirectory }}/package.json

- name: setup node
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.nodeVersion }}
cache: ${{ inputs.packageManager }}
cache-dependency-path: |
**/pnpm-lock.yaml
**/yarn.lock
patches/**
- name: Install yarn package manager
shell: bash
if: inputs.packageManager == 'yarn' && inputs.packageManagerVersion == ''
run: yarn install --ignore-engines --frozen-lockfile --immutable
working-directory: ${{ inputs.workingDirectory }}

- name: Install modern yarn package manager
shell: bash
if: inputs.packageManager == 'yarn' && inputs.packageManagerVersion == 'modern'
run: corepack enable && yarn
working-directory: ${{ inputs.workingDirectory }}

- name: Install pnpm package manager
shell: bash
if: inputs.packageManager == 'pnpm'
run: pnpm install --no-frozen-lockfile
working-directory: ${{ inputs.workingDirectory }}

- name: Get pnpm store directory
if: inputs.packageManager == 'pnpm'
shell: bash
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Set up npm registry
uses: actions/setup-node@v4
if: inputs.packageManager == 'pnpm'
with:
registry-url: https://registry.npmjs.org/
node-version-file: .github/.nvmrc
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Setup pnpm config registry
if: inputs.packageManager == 'pnpm'
run: pnpm config set registry https://registry.npmjs.org
shell: bash
3 changes: 3 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
- name: "no-stale"
color: fef2c0
description: "This issue or PR is exempted from the stable bot."
- name: "confirmed"
color: fbca04
description: "The issue has been confirmed by a developer."

- name: "security"
color: ee0701
Expand Down
43 changes: 10 additions & 33 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
":pinAllExceptPeerDependencies"
],
"semanticCommits": "enabled",
"reviewers": [
"@sullivanpj"
],
"reviewers": ["@sullivanpj"],
"rebaseWhen": "conflicted",
"rangeStrategy": "pin",
"automerge": true,
Expand All @@ -24,9 +22,7 @@
},
"packageRules": [
{
"matchPackagePatterns": [
"^@storm-software/"
],
"matchPackagePatterns": ["^@storm-software/"],
"enabled": true
},
{
Expand All @@ -41,45 +37,26 @@
"enabled": false
},
{
"matchPackageNames": [
"@nx"
],
"matchPackageNames": ["@nx"],
"postUpgradeTasks": {
"commands": [
"pnpm nx migrate latest --run-migrations --create-commits --commit-message='chore(@storm-software/storm-ops): update @nx dependencies [skip ci]'"
"pnpm nx migrate latest --run-migrations --create-commits --commit-message='chore(storm-ops): update @nx dependencies [skip ci]'"
]
}
},
{
"groupName": "dependencies-non-major",
"matchUpdateTypes": [
"digest",
"minor",
"patch",
"pin"
]
"matchUpdateTypes": ["digest", "minor", "patch", "pin"]
},
{
"groupName": "patch & minor dev dependencies",
"depTypeList": [
"devDependencies"
],
"updateTypes": [
"digest",
"minor",
"patch",
"pin"
]
"depTypeList": ["devDependencies"],
"updateTypes": ["digest", "minor", "patch", "pin"]
},
{
"groupName": "patch prod dependencies",
"depTypeList": [
"dependencies"
],
"updateTypes": [
"patch",
"pin"
]
"depTypeList": ["dependencies"],
"updateTypes": ["patch", "pin"]
}
]
}
}
39 changes: 22 additions & 17 deletions .github/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,32 @@ markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when removing the stale label.
# unmarkComment: >
# Your comment here.
unmarkComment: >
The issue has been closed due to inactivity. Please feel free to reopen with
additional information if you still face this issue.
# Comment to post when closing a stale Issue or Pull Request.
# closeComment: >
# Your comment here.
closeComment: >
This issue is being closed due to inactivity. If you still face this issue,
please feel free to reopen with additional information. Thank you for your
contributions.
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 30
# Limit to only `issues` or `pulls`
# only: issues

# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
# pulls:
# daysUntilStale: 30
# markComment: >
# This pull request has been automatically marked as stale because it has not had
# recent activity. It will be closed if no further activity occurs. Thank you
# for your contributions.

# issues:
# exemptLabels:
# - confirmed
only: issues

Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
pulls:
daysUntilStale: 30
markComment: >
This pull request has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
issues:
exemptLabels:
- "no-stale"
- "confirmed"
Loading

0 comments on commit 1c9a539

Please sign in to comment.