Skip to content

Gradle Deploy Snapshot #28

Gradle Deploy Snapshot

Gradle Deploy Snapshot #28

# (c) https://github.com/MontiCore/monticore
# This workflow publishes the jar of a (GitHub) publication, and then triggers downstream projects
name: Gradle Deploy Snapshot
concurrency: # run this deploy workflow only once per repository
group: ${{ github.repository }}-${{ github.workflow }}
cancel-in-progress: true
on:
workflow_run: # Note: This event will only trigger a workflow run if the workflow file is on the default branch
workflows: [ Gradle Test & Build ]
branches: [ dev ]
types:
- completed
permissions:
contents: read
packages: write
env:
GRADLE_VERSION: 7.4 # Gradle version used
GRADLE_CLI_OPTS: "-Pci" # CLI option passed to Gradle
jobs:
# Deploy the snapshot-publications to the snapshot repository (both nexus and GitHub Packages)
deploy-snapshot:
if: ${{ github.event.workflow_run.conclusion == 'success' }} # only run if tests were successful
runs-on: ubuntu-latest
steps:
- name: Checkout project sources
uses: actions/checkout@v3
- name: Deploy the snapshot
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: ${{env.GRADLE_VERSION}}
arguments: deployMC ${{env.GRADLE_CLI_OPTS}} -PmavenPassword=${{secrets.SE_NEXUS_PASSWORD}} -PmavenUser=${{secrets.SE_NEXUS_USER}} -PgenEMF=true -PgenTR=true -PgenTagging=true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Trigger GitHub downstream projects (without reporting the pipeline result)
trigger-github-downstream:
needs: [ deploy-snapshot ]
runs-on: ubuntu-latest
strategy:
matrix:
project: [ "MontiCore/cd4analysis", "MontiCore/feature-diagram", "MontiCore/xml", "MontiCore/json", "MontiCore/ucd", "MontiCore/automaton" ]
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
# We do not trigger (internal) GitLab downstream projects