2024-08-10 04:53:10 +00:00
|
|
|
name: master-publish-package.yaml
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
2024-08-10 05:23:20 +00:00
|
|
|
- "master"
|
|
|
|
- "release-test-master"
|
2024-08-10 04:53:10 +00:00
|
|
|
jobs:
|
|
|
|
release-diff-check:
|
|
|
|
name: Release diff check
|
|
|
|
runs-on: ubuntu-latest
|
2024-08-10 06:30:11 +00:00
|
|
|
outputs:
|
|
|
|
diff: ${{ steps.check-diff.outputs.result }}
|
2024-08-10 04:53:10 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
2024-08-10 05:44:05 +00:00
|
|
|
- name: fetch git
|
2024-08-10 05:46:50 +00:00
|
|
|
run: git fetch --depth 1 origin
|
2024-08-10 05:44:05 +00:00
|
|
|
|
2024-08-10 04:53:10 +00:00
|
|
|
- name: Check diff
|
|
|
|
id: check-diff
|
|
|
|
uses: actions/github-script@v3
|
|
|
|
with:
|
|
|
|
result-encoding: 'json'
|
|
|
|
script: |
|
|
|
|
const fs = require('fs')
|
|
|
|
const {execSync} = require('child_process');
|
|
|
|
const jsonData = JSON.parse(fs.readFileSync('./.github/monorepo.json', 'utf8'));
|
2024-08-10 05:12:27 +00:00
|
|
|
const baseRef = context.payload.pull_request.base.ref
|
2024-08-10 05:11:15 +00:00
|
|
|
console.log(baseRef)
|
2024-08-10 04:53:10 +00:00
|
|
|
var tags = []
|
|
|
|
|
|
|
|
for (let [key, value] of Object.entries(jsonData.projects)) {
|
2024-08-10 05:49:41 +00:00
|
|
|
console.log(execSync("git branch", {encoding: 'utf8'}))
|
2024-08-10 05:39:59 +00:00
|
|
|
const command = "git diff origin/" + baseRef + " -- HEAD --name-only --relative=" + key + "\n";
|
2024-08-10 04:53:10 +00:00
|
|
|
const output = execSync(command, {encoding: 'utf8'});
|
2024-08-10 05:49:41 +00:00
|
|
|
console.log(output)
|
2024-08-10 05:52:26 +00:00
|
|
|
if (output.trim() === '') {
|
2024-08-10 04:53:10 +00:00
|
|
|
tags.push(value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return tags
|
|
|
|
|
|
|
|
- name: show diff
|
|
|
|
env:
|
|
|
|
DIFF: ${{ steps.check-diff.outputs.result }}
|
2024-08-10 06:30:11 +00:00
|
|
|
run: echo "$DIFF"
|
|
|
|
|
|
|
|
publish-package:
|
|
|
|
runs-on: ubuntu-latest
|
2024-08-10 07:30:33 +00:00
|
|
|
needs: release-diff-check
|
2024-08-10 06:30:11 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Gradle Wrapper Validation
|
|
|
|
uses: gradle/actions/wrapper-validation@v4
|
|
|
|
|
|
|
|
- name: Set up JDK 21
|
|
|
|
uses: actions/setup-java@v4
|
|
|
|
with:
|
|
|
|
java-version: '21'
|
|
|
|
distribution: 'temurin'
|
|
|
|
|
|
|
|
- name: Setup Gradle
|
|
|
|
uses: gradle/actions/setup-gradle@v4
|
|
|
|
with:
|
|
|
|
cache-read-only: false
|
|
|
|
gradle-home-cache-cleanup: true
|
|
|
|
|
2024-08-10 06:51:03 +00:00
|
|
|
- name: Publish OWL Local
|
2024-08-10 07:08:44 +00:00
|
|
|
if: ${{ github.base_ref == 'release-test-master' && contains( needs.release-diff-check.outputs.diff, 'owl') }}
|
2024-08-10 06:41:38 +00:00
|
|
|
run: ./owl/gradlew :owl:publishMavenPublicationToMavenLocal
|
2024-08-10 06:51:03 +00:00
|
|
|
|
|
|
|
- name: Publish OWL Gitea
|
2024-08-10 07:27:16 +00:00
|
|
|
|
2024-08-10 07:06:57 +00:00
|
|
|
if: ${{ github.base_ref == 'master' && contains( needs.release-diff-check.outputs.diff , 'owl')}}
|
2024-08-10 07:58:09 +00:00
|
|
|
run: ./owl/gradlew :owl:publishMavenPublicationToGiteaRepository
|
|
|
|
env:
|
|
|
|
USERNAME: ${{ github.actor }}
|
|
|
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
GITEA: ${{ secrets.GITEA }}
|