Skip to content

Commit

Permalink
GitHub Action
Browse files Browse the repository at this point in the history
  • Loading branch information
luepges committed Nov 4, 2024
1 parent 5f84e42 commit abf0b23
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# (c) https://github.com/MontiCore/monticore
name: Gradle


concurrency: # run this test workflow only once per "branch"
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push: # run this test pipeline on every push
pull_request: # and pull request
repository_dispatch: # and on request of upstream projects
types: [ trigger_after_upstream_deploy ]


env:
GRADLE_VERSION: 7.4 # Gradle version used
GRADLE_CLI_OPTS: "-Pci --build-cache " # CLI options passed to Gradle

permissions:
contents: read # This action may run somewhat unsafe code


jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout project sources
uses: actions/checkout@v3
- name: Gradle build
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: ${{env.GRADLE_VERSION}}
arguments: build ${{env.GRADLE_CLI_OPTS}}

deploy:
permissions:
packages: write
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/dev'
steps:
- name: Checkout project sources
uses: actions/checkout@v3
- name: Gradle publish
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: ${{env.GRADLE_VERSION}}
arguments: publish ${{env.GRADLE_CLI_OPTS}} -PmavenPassword=${{ secrets.SE_NEXUS_PASSWORD }} -PmavenUser=${{ secrets.SE_NEXUS_USER }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Trigger GitHub downstream projects (without reporting the pipeline result)
trigger-github-downstream:
needs: [ deploy ]
runs-on: ubuntu-latest
strategy:
matrix:
project: [ "MontiCore/sequence-diagram", "MontiCore/sysmlv2" ]
steps:
- name: Trigger ${{ matrix.project }}
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.DOWNSTREAM_PAT }}
repository: ${{ matrix.project }}
event-type: trigger_after_upstream_deploy

0 comments on commit abf0b23

Please sign in to comment.