Skip to content

Commit

Permalink
ci: seutp github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mbainter committed Nov 22, 2023
1 parent 69f9d9c commit 5b5d052
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.github @mbainter
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
time: "10:00"
timezone: "America/Chicago"
commit-message:
prefix: "chore: "
include: "scope"
54 changes: 54 additions & 0 deletions .github/workflows/check-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: 'Validate PR title'

permissions:
pull-requests: read
checks: read
statuses: write

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
# Please look up the latest version from
# https://github.com/amannn/action-semantic-pull-request/releases
- uses: amannn/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
# Configure which types are allowed.
# Default: https://github.com/commitizen/conventional-commit-types
types: |
fix
feat
docs
ci
chore
style
refactor
test
requireScope: false
subjectPattern: ^[A-Z].+$
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
starts with an uppercase character.
# For work-in-progress PRs you can typically use draft pull requests
# from Github. However, private repositories on the free plan don't have
# this option and therefore this action allows you to opt-in to using the
# special "[WIP]" prefix to indicate this state. This will avoid the
# validation of the PR title and the pull request checks remain pending.
# Note that a second check will be reported if this is enabled.
wip: true
# When using "Squash and merge" on a PR with only one commit, GitHub
# will suggest using that commit message instead of the PR title for the
# merge commit, and it's easy to commit this by mistake. Enable this option
# to also validate the commit message for one commit PRs.
validateSingleCommit: true
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and release
on:
# Create the tests pass...
workflow_run:
workflows:
- Run tests
branches:
- main
types:
- completed
workflow_dispatch:

env:
DATAPACK_BASENAME: "bmc3-mining-dimension"

jobs:
release:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run PackSquash
uses: ComunidadAylas/PackSquash-action@v4
with:
artifact_name: "$DATAPACK_BASENAME"
packsquash_version: latest
options: |
pack-directory = '.'
output_file_path = '/tmp/${DATAPACK_BASENAME}.zip'
- name: Tag and create release
uses: softprops/action-gh-release@v1
with:
tag_name: "v${{ github.run_number }}"
files: "/tmp/${DATAPACK_BASENAME}.zip"
40 changes: 40 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Run tests
on:
pull_request:
push:
branches:
- main
paths:
- data/**
jobs:
build-main:
runs-on: ubuntu-latest
steps:
# Clones repository so it has access to the files
- name: Checkout repo
uses: actions/checkout@v4
- name: Determine the pull-request id
id: pr
run: echo "::set-output name=pr_number::$(gh pr view --json number -q .number || echo "")"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Checks mcfunction files for errors
- name: Check commands
uses: mcbeet/check-commands@v1
with:
source: .
minecraft: 1.19
# Checks JSON for errors
- name: Check JSON
uses: ocular-d/[email protected]
# Uploads an artifact that you can download and use in your Minecraft world
- name: Compile and upload
uses: actions/upload-artifact@v3
with:
name: bmc3-mining-dimension-pr${{steps.pr.outputs.pr_number}}
path: |
data/
pack.mcmeta
pack.png
# Errors if files aren't found
if-no-files-found: error

0 comments on commit 5b5d052

Please sign in to comment.