Skip to content

Commit

Permalink
feat(workflows): implement build and release workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
LeafdTK committed Oct 14, 2024
1 parent fff5195 commit abaf64b
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
name: Build

"on":
workflow_call:
inputs:
path:
description: Path to package directory
required: true
type: string
manifest:
description: Output from release-please
required: true
type: string
workflow_dispatch:
inputs:
path:
description: Path to package directory
required: true
type: string

jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.PAT }}
- name: JDK Setup
uses: actions/setup-java@v3
with:
cache: maven
java-version: '17'
distribution: temurin
- name: Maven Package
run: |
mvn --batch-mode clean package
test -f ./target/*.jar
working-directory: ${{ inputs.path }}
- name: Upload Artifact to Release
if: github.event_name == 'workflow_call'
uses: shogo82148/[email protected]
with:
github_token: ${{ secrets.PAT }}
upload_url: ${{ fromJSON(inputs.manifest)[format('{0}--upload_url', inputs.path)] }}
asset_path: ./${{ inputs.path }}/target/*.jar
asset_content_type: application/java-archive
overwrite: true
- name: Publish to GitHub Packages
run: mvn --batch-mode deploy
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
working-directory: ${{ inputs.path }}
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: Release Please

"on":
workflow_dispatch:
push:
branches:
- main

concurrency:
group: release-please
cancel-in-progress: false

jobs:
release-please:
name: Release Please
outputs:
manifest: ${{ toJSON(steps.rp.outputs) }}
runs-on: ubuntu-22.04
steps:
- name: Generate App Token
uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Release Please
id: rp
uses: GoogleCloudPlatform/[email protected]
with:
token: ${{ steps.generate-token.outputs.token }}
matrix:
if: ${{ fromJSON(needs.release-please.outputs.manifest).releases_created == 'true' }}
needs: [release-please]
secrets: inherit
strategy:
matrix:
path: ${{ fromJSON(fromJSON(needs.release-please.outputs.manifest).paths_released) }}
uses: ./.github/workflows/build.yml
with:
path: ${{ matrix.path }}
manifest: ${{ needs.release-please.outputs.manifest }}
16 changes: 16 additions & 0 deletions .idea/checkstyle-idea.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file added .release-please-manifest.json
Empty file.
8 changes: 8 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"packages": {
"sulla": {
"package-name": "oxygen",
"release-type": "maven"
}
}
}

0 comments on commit abaf64b

Please sign in to comment.