forked from jelovirt/org.lwdita
-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (85 loc) · 2.81 KB
/
dist.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Distribution
on:
push:
branches:
- '!*'
tags:
- '*'
jobs:
dist:
if: github.repository == 'jelovirt/org.lwdita'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
cache: gradle
- name: Build with Gradle
run: ./gradlew dist
- name: Set variables
run: |
echo "CHKSUM=$(shasum -a 256 build/distributions/org.lwdita-*.zip | cut -d ' ' -f 1)" >> $GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v1
with:
files: build/distributions/org.lwdita-*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
shasum: ${{ env.CHKSUM }}
publish:
needs: dist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
cache: gradle
- name: Publish package
run: ./gradlew publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
registry:
needs: dist
runs-on: ubuntu-latest
steps:
- name: Set variables
run: |
echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_ENV
echo "PLUGIN_NAME=org.lwdita" >> $GITHUB_ENV
- name: Check out registry
uses: actions/checkout@v3
with:
repository: dita-ot/registry
path: registry
- name: Update registry
working-directory: registry
run: |
URL=https://github.com/jelovirt/org.lwdita/releases/download/${{ env.VERSION }}/org.lwdita-${{ env.VERSION }}.zip
cat ${{ env.PLUGIN_NAME }}.json \
| jq '.[length -1]' \
| jq --arg url "$URL" '. | .url|=$url' \
| jq --arg chksum "${{ needs.dist.outputs.shasum }}" '. | .cksum|=$chksum' \
| jq --arg vers "${{ env.VERSION }}" '. | .vers|=$vers' > buf.json
jq '. += [input]' ${{ env.PLUGIN_NAME }}.json buf.json \
| jq . > concat.json
mv concat.json ${{ env.PLUGIN_NAME }}.json
rm buf.json
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
path: registry
token: ${{ secrets.TOKEN }}
push-to-fork: jelovirt/registry
branch-suffix: timestamp
commit-message: Add ${{ env.PLUGIN_NAME }} ${{ env.VERSION }}
title: Add ${{ env.PLUGIN_NAME }} ${{ env.VERSION }}
body: |
Add plug-in `${{ env.PLUGIN_NAME }}` version `${{ env.VERSION }}`.
* [Release notes](https://github.com/jelovirt/org.lwdita/releases/tag/${{ env.VERSION }})