Skip to content

Commit

Permalink
chore: add github
Browse files Browse the repository at this point in the history
  • Loading branch information
nichenqin committed Aug 1, 2024
1 parent 5f6444f commit cce2783
Show file tree
Hide file tree
Showing 7 changed files with 308 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: undbxyz
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
polar: # Replace with a single Polar username
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
66 changes: 66 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG-REPORT.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: '🐛 Bug Report'
description: Create a new ticket for a bug.
title: '🐛 [BUG] - <title>'
labels: ['bug']
body:
- type: textarea
id: description
attributes:
label: 'Description'
description: Please enter an explicit description of your issue
placeholder: Short and explicit description of your incident...
validations:
required: true
- type: input
id: reprod-url
attributes:
label: 'Reproduction URL'
description: Please enter your GitHub URL to provide a reproduction of the issue
placeholder: ex. https://github.com/undb-xyz/undb
validations:
required: false
- type: textarea
id: reprod
attributes:
label: 'Reproduction steps'
description: Please enter an explicit description of your issue
value: |
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
render: bash
validations:
required: true
- type: textarea
id: screenshot
attributes:
label: 'Screenshots'
description: If applicable, add screenshots to help explain your problem.
value: |
![DESCRIPTION](LINK.png)
render: bash
validations:
required: false
- type: textarea
id: logs
attributes:
label: 'Logs'
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: bash
validations:
required: false
- type: dropdown
id: browsers
attributes:
label: 'Browsers'
description: What browsers are you seeing the problem on ?
multiple: true
options:
- Firefox
- Chrome
- Safari
- Microsoft Edge
- Opera
validations:
required: false
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE-REQUEST.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Feature request
description: Suggest a feature to improve undb
title: '[feature]: '
labels: [feature]
body:
- type: markdown
attributes:
value: |
Thank you for taking the time to request a feature for undb
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue related to this feature request already exists
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Summary
description: One paragraph description of the feature
validations:
required: true
- type: textarea
attributes:
label: Why should this be worked on?
description: A concise description of the problems or use cases for this feature request
validations:
required: true
40 changes: 40 additions & 0 deletions .github/workflows/build-and-push-to-registry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and push to registry

on:
push:
tags:
- 'v*'

jobs:
docker:
runs-on: ubuntu-latest

steps:
- name: Fetch Sources
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
- name: Build undb and push
uses: docker/build-push-action@v5
with:
push: true
context: .
file: Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
33 changes: 33 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on:
push:
branches: ['develop']
pull_request:
types: [opened, synchronize]

jobs:
build:
name: Build
timeout-minutes: 15
runs-on: ubuntu-latest
# To use Remote Caching, uncomment the next lines and follow the steps below.
# env:
# TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
# TURBO_TEAM: ${{ secrets.TURBO_TEAM }}

env:
TZ: UTC
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Setup bun environment
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: bun install

- name: Build
run: bun run build

71 changes: 71 additions & 0 deletions .github/workflows/draft-new-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: 'Draft new release'

on:
workflow_dispatch:
inputs:
semver:
description: 'The version you want to release.'
required: true
type: choice
default: patch
options:
- major
- minor
- patch

jobs:
draft-new-release:
name: 'Draft a new release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup bun environment
uses: oven-sh/setup-bun@v2
i
- name: changelogen
run: |
bunx changelogen@latest --bump --${{ inputs.semver }}
- name: Get version from package.json
id: package-version
uses: martinbeentjes/npm-get-version-action@v1.3.1

- name: Create release branch
run: git checkout -b release/v${{ steps.package-version.outputs.current-version }}

- name: Initialize mandatory git config
run: |
git config user.name "GitHub actions"
git config user.email noreply@github.com
- name: Commit manifest files
id: make-commit
run: |
git add package.json CHANGELOG.md
git commit --message "Prepare release v${{ steps.package-version.outputs.current-version }}"
echo "::set-output name=commit::$(git rev-parse HEAD)"
- name: Push new branch
run: git push origin release/v${{ steps.package-version.outputs.current-version }}

- name: Create pull request
uses: thomaseizinger/create-pull-request@1.3.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
head: release/v${{ steps.package-version.outputs.current-version }}
base: main
title: Release version v${{ steps.package-version.outputs.current-version }}
reviewers: ${{ github.actor }} # By default, we request a review from the person who triggered the workflow.
# Write a nice message to the user.
# We are claiming things here based on the `publish-new-release.yml` workflow.
# You should obviously adopt it to say the truth depending on your release workflow :)
body: |
Hi @${{ github.actor }}!
This PR was created in response to a manual trigger of the release workflow here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}.
I've updated the changelog and bumped the versions in the manifest files in this commit: ${{ steps.make-commit.outputs.commit }}.
Merging this PR will create a GitHub release and upload any assets that are created as part of the release build.
56 changes: 56 additions & 0 deletions .github/workflows/publish-new-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: 'Publish new release'

on:
pull_request:
branches:
- main
types:
- closed

jobs:
release:
name: Publish new release
runs-on: ubuntu-latest
# only merged pull requests that begin with 'release/' or 'hotfix/' must trigger this job
if: github.event.pull_request.merged == true &&
(startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix/'))

steps:
- name: Extract version from branch name (for release branches)
if: startsWith(github.event.pull_request.head.ref, 'release/')
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#release/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Extract version from branch name (for hotfix branches)
if: startsWith(github.event.pull_request.head.ref, 'hotfix/')
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#hotfix/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.PAT }}
tag_name: ${{ env.RELEASE_VERSION }}
name: ${{ env.RELEASE_VERSION }}
generate_release_notes: true
draft: false
prerelease: false
target_commitish: ${{ github.event.pull_request.merge_commit_sha }}

- name: Merge main into develop branch
uses: thomaseizinger/create-pull-request@1.3.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
head: main
base: develop
title: Merge main into develop branch
body: |
This PR merges the main branch back into develop.
This happens to ensure that the updates that happend on the release branch, i.e. CHANGELOG and manifest updates are also present on the develop branch.

0 comments on commit cce2783

Please sign in to comment.