Skip to content

Commit fb0638c

Browse files
Merge pull request #1 from trueberryless-org/update-template-files
2 parents ad56627 + a68b574 commit fb0638c

File tree

18 files changed

+685
-100
lines changed

18 files changed

+685
-100
lines changed

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.dockerignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Dockerfile
2+
.dockerignore
3+
**/node_modules/
4+
**/.git
5+
README.md
6+
npm-debug.log
7+
.coverage
8+
.coverage.*
9+
.env
10+
.aws
11+
.next

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @trueberryless

.github/labeler.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# See https://github.com/actions/labeler/tree/v5
2+
3+
"🚨 action":
4+
- changed-files:
5+
- any-glob-to-any-file: .github/workflows/**
6+
7+
"📝 changeset":
8+
- changed-files:
9+
- any-glob-to-any-file: "**/.changeset/**.{md,mdx}"
10+
11+
"🚧 config":
12+
- changed-files:
13+
- any-glob-to-any-file: "**/*config*.{js,ts,jsx,tsx,mjs,mts,json,yml,yaml,toml,cjs,cts}"
14+
15+
"✒️ documentation":
16+
- changed-files:
17+
- any-glob-to-any-file: "**/README.md"
18+
19+
"🌏 i18n":
20+
- changed-files:
21+
- all-globs-to-any-file: ["**/docs/**", "!**/docs/en/**"]
22+
23+
"🚀 manifest":
24+
- changed-files:
25+
- any-glob-to-any-file: "manifest*/**"
26+
27+
"📦 package":
28+
- changed-files:
29+
- any-glob-to-any-file: "**/packages/**"
30+
- any-glob-to-any-file: "**/package.json"
31+
32+
"🏯 styles":
33+
- changed-files:
34+
- any-glob-to-any-file: "**/*.{css,scss,sass,less,styl}"

.github/renovate.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
":disableDependencyDashboard",
5+
":disablePeerDependencies",
6+
":semanticPrefixFixDepsChoreOthers",
7+
":ignoreModulesAndTests",
8+
"workarounds:all",
9+
"helpers:pinGitHubActionDigestsToSemver",
10+
"docker:disable"
11+
],
12+
"rangeStrategy": "bump",
13+
"ignorePaths": ["**/node_modules/**"],
14+
"commitMessageSuffix": "[skip ci]",
15+
"packageRules": [
16+
{
17+
"groupName": "github-actions",
18+
"matchManagers": ["github-actions"]
19+
},
20+
{
21+
"matchManagers": ["npm"],
22+
"matchDepTypes": ["dependencies", "devDependencies"],
23+
"separateMajorMinor": true
24+
},
25+
{
26+
"description": "Disable package manager version updates",
27+
"matchPackageNames": ["pnpm"],
28+
"matchDepTypes": ["packageManager"],
29+
"enabled": false
30+
}
31+
]
32+
}

.github/workflows/deployment.yaml

Lines changed: 172 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,180 @@
11
name: Deployment
22

33
on:
4-
push:
5-
branches: [main]
6-
merge_group:
7-
pull_request:
8-
branches: [main]
9-
# Allows you to run this workflow manually from the Actions tab
10-
workflow_dispatch:
11-
12-
# Automatically cancel in-progress actions on the same branch
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
138
concurrency:
14-
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}
15-
cancel-in-progress: true
9+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}
10+
cancel-in-progress: true
1611

1712
env:
18-
REGISTRY: docker.io
19-
IMAGE_NAME: trueberryless/truzzles
20-
NODE_VERSION: 20
13+
REGISTRY: docker.io
14+
IMAGE_OWNER: trueberryless
15+
IMAGE_NAME: truzzles
16+
NODE_VERSION: 20
2117

2218
jobs:
23-
deployment:
24-
if: contains(github.event.head_commit.message, 'deploy') || github.event_name == 'workflow_dispatch'
25-
runs-on: ubuntu-latest
26-
permissions:
27-
contents: write
28-
steps:
29-
- name: Check out the repo
30-
uses: actions/checkout@v4
31-
with:
32-
fetch-depth: 0
33-
34-
- name: Create tag
35-
run: echo "IMAGE_TAG=$(echo $GITHUB_REF_NAME-$GITHUB_SHA)" >> $GITHUB_ENV
36-
37-
- name: Set up Docker Buildx
38-
uses: docker/setup-buildx-action@v2
39-
40-
- name: Log in to Docker Hub
41-
uses: docker/login-action@v2
42-
with:
43-
username: ${{ secrets.DOCKER_USERNAME }}
44-
password: ${{ secrets.DOCKER_PASSWORD }}
45-
46-
- name: Extract metadata (tags, labels) for Docker
47-
id: meta
48-
uses: docker/metadata-action@v4
49-
with:
50-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
51-
52-
- name: Build and push Docker image
53-
uses: docker/build-push-action@v5
54-
with:
55-
context: .
56-
push: true
57-
tags: |
58-
${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
59-
${{ env.IMAGE_NAME }}:latest
60-
labels: ${{ steps.meta.outputs.labels }}
61-
62-
- name: Update deployment.yaml file
63-
run: |
64-
yq eval '.spec.template.spec.containers[0].image = "${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}"' -i manifest/deployment.yaml
65-
66-
- uses: stefanzweifel/git-auto-commit-action@v4
67-
with:
68-
commit_message: update deployment.json container image (automated)
69-
70-
- uses: ncipollo/release-action@v1
71-
with:
72-
tag: ${{ env.IMAGE_TAG }}
73-
makeLatest: true
74-
body: "A docker image has been deployed to [Docker Hub](https://hub.docker.com/r/${{ env.IMAGE_NAME }}/tags)."
19+
changesets:
20+
name: Changesets
21+
runs-on: ubuntu-latest
22+
outputs:
23+
hasChangesets: ${{ steps.changesets.outputs.hasChangesets }}
24+
permissions:
25+
contents: write
26+
pull-requests: write
27+
steps:
28+
- name: Generate GitHub App token
29+
id: generate_token
30+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
31+
with:
32+
app_id: ${{ secrets.BOT_APP_ID }}
33+
private_key: ${{ secrets.BOT_PRIVATE_KEY }}
34+
35+
- name: Checkout Repo
36+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
37+
38+
- name: Setup PNPM
39+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
40+
41+
- name: Setup Node
42+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
43+
with:
44+
node-version: ${{ env.NODE_VERSION }}
45+
cache: "pnpm"
46+
47+
- name: Install Dependencies
48+
run: pnpm i
49+
50+
- name: Create Release Pull Request
51+
uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3
52+
id: changesets
53+
with:
54+
version: pnpm run version
55+
commit: "ci: release"
56+
title: "ci: release [skip netlify]"
57+
env:
58+
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token}}
59+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
60+
61+
- name: Get published version
62+
if: steps.changesets.outputs.hasChangesets == 'true'
63+
run: |
64+
git checkout changeset-release/main
65+
VERSION=$(node -p "require('./<%= projectFolder %>/package.json').version")
66+
NAME=$(node -p "require('./<%= projectFolder %>/package.json').name")
67+
git commit --amend -m "ci: release $NAME v$VERSION" --no-edit
68+
git push origin changeset-release/main:changeset-release/main --force
69+
70+
image-tag:
71+
name: Image Tag
72+
runs-on: ubuntu-latest
73+
outputs:
74+
IMAGE_TAG: ${{ env.IMAGE_TAG }}
75+
steps:
76+
- name: Check out the repo
77+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
78+
79+
- name: Read version from package.json
80+
id: get_version
81+
run: |
82+
VERSION=$(jq -r '.version' <%= projectFolder %>/package.json)
83+
echo "IMAGE_TAG=$VERSION" >> $GITHUB_ENV
84+
85+
deployment:
86+
needs: [changesets, image-tag]
87+
if: >
88+
(
89+
needs.changesets.outputs.hasChangesets == 'false' &&
90+
(
91+
contains(github.event.head_commit.message, 'deploy') ||
92+
contains(github.event.head_commit.message, 'release')
93+
)
94+
) ||
95+
github.event_name == 'workflow_dispatch'
96+
runs-on: ubuntu-latest
97+
permissions:
98+
contents: write
99+
steps:
100+
- name: Check out the repo
101+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
102+
with:
103+
fetch-depth: 0
104+
105+
- name: Set up Docker Buildx
106+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
107+
108+
- name: Log in to Docker Hub
109+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
110+
with:
111+
username: ${{ secrets.DOCKER_USERNAME }}
112+
password: ${{ secrets.DOCKER_PASSWORD }}
113+
114+
- name: Extract metadata (tags, labels) for Docker
115+
id: meta
116+
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
117+
with:
118+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}
119+
120+
- name: Build and push Docker image
121+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
122+
with:
123+
context: ./<%= projectFolder %>
124+
push: true
125+
tags: |
126+
${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ needs.image-tag.outputs.IMAGE_TAG }}
127+
${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:latest
128+
labels: ${{ steps.meta.outputs.labels }}
129+
130+
- name: Update deployment.yaml file
131+
run: |
132+
yq eval '.spec.template.spec.containers[0].image = "${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ needs.image-tag.outputs.IMAGE_TAG }}"' -i manifest/deployment.yaml
133+
134+
- uses: stefanzweifel/git-auto-commit-action@b863ae1933cb653a53c021fe36dbb774e1fb9403 # v5.2.0
135+
with:
136+
commit_message: update deployment.json container image (automated)
137+
138+
release:
139+
name: Release
140+
needs: [image-tag, deployment]
141+
runs-on: ubuntu-latest
142+
permissions:
143+
contents: write
144+
steps:
145+
- name: Check out the repo
146+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
147+
148+
- id: extract-changelog
149+
uses: sean0x42/markdown-extract@7b185cbe85263116bbf741e739e7198ba86465dc # v2.1.0
150+
with:
151+
file: <%= projectFolder %>/CHANGELOG.md
152+
pattern: ${{ needs.image-tag.outputs.IMAGE_TAG }}
153+
154+
- uses: ncipollo/release-action@v1
155+
id: create_release
156+
with:
157+
tag: ${{ env.IMAGE_NAME }}@${{ needs.image-tag.outputs.IMAGE_TAG }}
158+
makeLatest: false
159+
body: ${{ steps.extract-changelog.outputs.markdown }}
160+
skipIfReleaseExists: true
161+
162+
- name: Check if release was created
163+
id: check_release
164+
run: |
165+
if [ -z "${{ steps.create_release.outputs.html_url }}" ]; then
166+
echo "RELEASE_SKIPPED=true" >> $GITHUB_ENV
167+
else
168+
echo "RELEASE_SKIPPED=false" >> $GITHUB_ENV
169+
fi
170+
171+
- name: Discord notification
172+
if: env.RELEASE_SKIPPED == 'false'
173+
env:
174+
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
175+
uses: Ilshidur/action-discord@d2594079a10f1d6739ee50a2471f0ca57418b554 # 0.4.0
176+
with:
177+
args: |
178+
# ${{ env.IMAGE_NAME }}@${{ needs.image-tag.outputs.IMAGE_TAG }}
179+
180+
${{ steps.extract-changelog.outputs.markdown }}

.github/workflows/format.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: autofix.ci
2+
on:
3+
pull_request:
4+
push:
5+
branches: [main]
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
autofix:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
14+
15+
- name: Setup PNPM
16+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
17+
18+
- name: Setup Node
19+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
20+
with:
21+
node-version: 20.19.5
22+
cache: "pnpm"
23+
24+
- name: Install Dependencies
25+
run: pnpm i
26+
27+
- name: Run prettier
28+
run: pnpm exec prettier . --write
29+
30+
# Optimize all PNGs with https://pngquant.org/
31+
- run: sudo apt-get update && sudo apt-get install -y pngquant
32+
- name: Run pngquant
33+
run: |
34+
shopt -s globstar
35+
find . -name '*.png' -exec pngquant --ext .png 256 {} \;
36+
37+
- uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27

0 commit comments

Comments
 (0)