Skip to content

Commit

Permalink
ci: add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
sekwah41 committed Mar 26, 2023
1 parent 2932d8a commit 6b25d3a
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pr_changelog_release_notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# What Changed
Whatever changed here

## Release Notes
If anything should be commented in the changelog release notes.
41 changes: 41 additions & 0 deletions .github/workflows/pre-commit-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "Pre-commit consistency check"

on:
workflow_dispatch:
pull_request:

concurrency:
group: ${{ github.head_ref }}-precommit
cancel-in-progress: true

jobs:
pre-commit-check:
name: Run pre-commit checks
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: dorny/paths-filter@v2
id: filter
with:
list-files: shell
filters: |
addedOrModified:
- added|modified: '**'
# run only if changed files were detected
- name: Run against changes
uses: pre-commit/action@v3.0.0
if: steps.filter.outputs.addedOrModified == 'true'
with:
extra_args: --files ${{ steps.filter.outputs.addedOrModified_files }}

# run if no changed files were detected (e.g. workflow_dispatch on master branch)
- name: Run against all files
uses: pre-commit/action@v3.0.0
if: steps.filter.outputs.addedOrModified != 'true'
with:
extra_args: --all-files
58 changes: 58 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
on:
workflow_dispatch:
push:
branches:
- master
name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
upload_url: ${{ steps.release.outputs.upload_url }}
# https://github.com/google-github-actions/release-please-action in case more config is needed
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
command: manifest
token: ${{ secrets.PAT }}
# See how to configure file https://github.com/googleapis/release-please/blob/main/docs/manifest-releaser.md
# See output info at https://github.com/google-github-actions/release-please-action#configuration for variables

# Possibly optimise this by building and then passing the folder across to these stages
release:
strategy:
fail-fast: false
matrix:
release-task: [curseforge, discordupload, modrinth]
needs: release-please
runs-on: ubuntu-latest
if: ${{ needs.release-please.outputs.release_created }}
steps:
- uses: actions/checkout@v3
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- name: Download MC assets
run: ./gradlew downloadAssets || ./gradlew downloadAssets || (sleep 30s && ./gradlew downloadAssets)
- name: Run DataGen
run: ./gradlew runData
- name: Build and publish (release)
env:
CURSE_API: ${{ secrets.CURSE_API }}
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
IS_RELEASE: true
run: |
# Build
./gradlew build ${{ matrix.release-task }}
33 changes: 33 additions & 0 deletions .github/workflows/snapshots.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on:
push:
branches-ignore:
- master
workflow_dispatch:
name: Build
jobs:
snapshot:
#if: ${{!startsWith(github.ref.split(’/’)[2], 'release-please')}}
runs-on: ubuntu-latest
# https://github.com/google-github-actions/release-please-action in case more config is needed
steps:
- uses: actions/checkout@v3
# these if statements ensure that a publication only occurs when
# a new release is created:
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 17
- name: Build and upload preview (run for non-release builds)
if: ${{ github.ref }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
run: |
# Build
./gradlew build discordupload

0 comments on commit 6b25d3a

Please sign in to comment.