Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Dockerfile
.dockerignore
**/node_modules/
**/.git
README.md
npm-debug.log
.coverage
.coverage.*
.env
.aws
.next
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @trueberryless
34 changes: 34 additions & 0 deletions .github/labeler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# See https://github.com/actions/labeler/tree/v5

"🚨 action":
- changed-files:
- any-glob-to-any-file: .github/workflows/**

"📝 changeset":
- changed-files:
- any-glob-to-any-file: "**/.changeset/**.{md,mdx}"

"🚧 config":
- changed-files:
- any-glob-to-any-file: "**/*config*.{js,ts,jsx,tsx,mjs,mts,json,yml,yaml,toml,cjs,cts}"

"✒️ documentation":
- changed-files:
- any-glob-to-any-file: "**/README.md"

"🌏 i18n":
- changed-files:
- all-globs-to-any-file: ["**/docs/**", "!**/docs/en/**"]

"🚀 manifest":
- changed-files:
- any-glob-to-any-file: "manifest*/**"

"📦 package":
- changed-files:
- any-glob-to-any-file: "**/packages/**"
- any-glob-to-any-file: "**/package.json"

"🏯 styles":
- changed-files:
- any-glob-to-any-file: "**/*.{css,scss,sass,less,styl}"
32 changes: 32 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
":disableDependencyDashboard",
":disablePeerDependencies",
":semanticPrefixFixDepsChoreOthers",
":ignoreModulesAndTests",
"workarounds:all",
"helpers:pinGitHubActionDigestsToSemver",
"docker:disable"
],
"rangeStrategy": "bump",
"ignorePaths": ["**/node_modules/**"],
"commitMessageSuffix": "[skip ci]",
"packageRules": [
{
"groupName": "github-actions",
"matchManagers": ["github-actions"]
},
{
"matchManagers": ["npm"],
"matchDepTypes": ["dependencies", "devDependencies"],
"separateMajorMinor": true
},
{
"description": "Disable package manager version updates",
"matchPackageNames": ["pnpm"],
"matchDepTypes": ["packageManager"],
"enabled": false
}
]
}
238 changes: 172 additions & 66 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,74 +1,180 @@
name: Deployment

on:
push:
branches: [main]
merge_group:
pull_request:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Automatically cancel in-progress actions on the same branch
push:
branches: [main]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}
cancel-in-progress: true

env:
REGISTRY: docker.io
IMAGE_NAME: trueberryless/truzzles
NODE_VERSION: 20
REGISTRY: docker.io
IMAGE_OWNER: trueberryless
IMAGE_NAME: truzzles
NODE_VERSION: 20

jobs:
deployment:
if: contains(github.event.head_commit.message, 'deploy') || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Create tag
run: echo "IMAGE_TAG=$(echo $GITHUB_REF_NAME-$GITHUB_SHA)" >> $GITHUB_ENV

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}

- name: Update deployment.yaml file
run: |
yq eval '.spec.template.spec.containers[0].image = "${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}"' -i manifest/deployment.yaml

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: update deployment.json container image (automated)

- uses: ncipollo/release-action@v1
with:
tag: ${{ env.IMAGE_TAG }}
makeLatest: true
body: "A docker image has been deployed to [Docker Hub](https://hub.docker.com/r/${{ env.IMAGE_NAME }}/tags)."
changesets:
name: Changesets
runs-on: ubuntu-latest
outputs:
hasChangesets: ${{ steps.changesets.outputs.hasChangesets }}
permissions:
contents: write
pull-requests: write
steps:
- name: Generate GitHub App token
id: generate_token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
with:
app_id: ${{ secrets.BOT_APP_ID }}
private_key: ${{ secrets.BOT_PRIVATE_KEY }}

- name: Checkout Repo
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0

- name: Setup PNPM
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0

- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"

- name: Install Dependencies
run: pnpm i

- name: Create Release Pull Request
uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3
id: changesets
with:
version: pnpm run version
commit: "ci: release"
title: "ci: release [skip netlify]"
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token}}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Get published version
if: steps.changesets.outputs.hasChangesets == 'true'
run: |
git checkout changeset-release/main
VERSION=$(node -p "require('./<%= projectFolder %>/package.json').version")
NAME=$(node -p "require('./<%= projectFolder %>/package.json').name")
git commit --amend -m "ci: release $NAME v$VERSION" --no-edit
git push origin changeset-release/main:changeset-release/main --force

image-tag:
name: Image Tag
runs-on: ubuntu-latest
outputs:
IMAGE_TAG: ${{ env.IMAGE_TAG }}
steps:
- name: Check out the repo
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0

- name: Read version from package.json
id: get_version
run: |
VERSION=$(jq -r '.version' <%= projectFolder %>/package.json)
echo "IMAGE_TAG=$VERSION" >> $GITHUB_ENV

deployment:
needs: [changesets, image-tag]
if: >
(
needs.changesets.outputs.hasChangesets == 'false' &&
(
contains(github.event.head_commit.message, 'deploy') ||
contains(github.event.head_commit.message, 'release')
)
) ||
github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out the repo
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
with:
fetch-depth: 0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1

- name: Log in to Docker Hub
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: ./<%= projectFolder %>
push: true
tags: |
${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ needs.image-tag.outputs.IMAGE_TAG }}
${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}

- name: Update deployment.yaml file
run: |
yq eval '.spec.template.spec.containers[0].image = "${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ needs.image-tag.outputs.IMAGE_TAG }}"' -i manifest/deployment.yaml

- uses: stefanzweifel/git-auto-commit-action@b863ae1933cb653a53c021fe36dbb774e1fb9403 # v5.2.0
with:
commit_message: update deployment.json container image (automated)

release:
name: Release
needs: [image-tag, deployment]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out the repo
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0

- id: extract-changelog
uses: sean0x42/markdown-extract@7b185cbe85263116bbf741e739e7198ba86465dc # v2.1.0
with:
file: <%= projectFolder %>/CHANGELOG.md
pattern: ${{ needs.image-tag.outputs.IMAGE_TAG }}

- uses: ncipollo/release-action@v1
id: create_release
with:
tag: ${{ env.IMAGE_NAME }}@${{ needs.image-tag.outputs.IMAGE_TAG }}
makeLatest: false
body: ${{ steps.extract-changelog.outputs.markdown }}
skipIfReleaseExists: true

- name: Check if release was created
id: check_release
run: |
if [ -z "${{ steps.create_release.outputs.html_url }}" ]; then
echo "RELEASE_SKIPPED=true" >> $GITHUB_ENV
else
echo "RELEASE_SKIPPED=false" >> $GITHUB_ENV
fi

- name: Discord notification
if: env.RELEASE_SKIPPED == 'false'
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
uses: Ilshidur/action-discord@d2594079a10f1d6739ee50a2471f0ca57418b554 # 0.4.0
with:
args: |
# ${{ env.IMAGE_NAME }}@${{ needs.image-tag.outputs.IMAGE_TAG }}

${{ steps.extract-changelog.outputs.markdown }}
37 changes: 37 additions & 0 deletions .github/workflows/format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: autofix.ci
on:
pull_request:
push:
branches: [main]
permissions:
contents: read

jobs:
autofix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0

- name: Setup PNPM
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0

- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 20.19.5
cache: "pnpm"

- name: Install Dependencies
run: pnpm i

- name: Run prettier
run: pnpm exec prettier . --write

# Optimize all PNGs with https://pngquant.org/
- run: sudo apt-get update && sudo apt-get install -y pngquant
- name: Run pngquant
run: |
shopt -s globstar
find . -name '*.png' -exec pngquant --ext .png 256 {} \;

- uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27
Loading
Loading