-
Notifications
You must be signed in to change notification settings - Fork 7
114 lines (104 loc) · 4.59 KB
/
Copy pathgh_release_plugins.yml
File metadata and controls
114 lines (104 loc) · 4.59 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# (c) https://github.com/MontiCore/monticore
name: Release Editor Plugins
concurrency: # run this test workflow only once per branch
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
# Always trigger plugin build, release upload is filtered in jobs
branches:
- '**'
tags:
- '**'
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: 8.14.4
- name: Build with Gradle
run: gradle :language-server:cd4a-intellij-plugin:buildPlugin :language-server:packageCD4AnalysisVscodePlugin -PbuildVscodePlugin=true -PbuildIntelliJPlugin=true
- name: Extract version name
shell: bash
run: |
echo "version=$(grep '^[[:space:]]*version[[:space:]]*=' gradle.properties | sed 's/^[[:space:]]*version[[:space:]]*=[[:space:]]*//' | sed 's/-SNAPSHOT$//')" >> $GITHUB_OUTPUT
echo "full_version=$(grep '^[[:space:]]*version[[:space:]]*=' gradle.properties | sed 's/^[[:space:]]*version[[:space:]]*=[[:space:]]*//')" >> $GITHUB_OUTPUT
id: extract_version
- name: Rename and move artifacts
run: |
mkdir dist
mv language-server/target/generated-sources/CD4Analysis/plugins/cd4analysis-vscode-plugin/cd4analysis-lsp-${{ steps.extract_version.outputs.full_version }}.vsix dist/CD4Analysis-${{ steps.extract_version.outputs.version }}.vsix
mv language-server/cd4a-intellij-plugin/target/distributions/cd4a-intellij-plugin-${{ steps.extract_version.outputs.full_version }}.zip dist/CD4Analysis-Intellij-Plugin-${{ steps.extract_version.outputs.version }}.zip
# Upload the build.
- name: 'Upload Vscode Artifact'
uses: actions/upload-artifact@v4
with:
name: CD4Analysis-${{ steps.extract_version.outputs.version }}.vsix
path: dist/CD4Analysis-${{ steps.extract_version.outputs.version }}.vsix
if-no-files-found: warn
- name: 'Upload Intellij Artifact'
uses: actions/upload-artifact@v4
with:
name: CD4Analysis-Intellij-Plugin-${{ steps.extract_version.outputs.version }}.zip
path: dist/CD4Analysis-Intellij-Plugin-${{ steps.extract_version.outputs.version }}.zip
if-no-files-found: warn
snapshot-release:
name: Release SNAPSHOT
runs-on: ubuntu-latest
# Only upload snapshot release on dev branch
if: github.repository_owner == 'MontiCore' && github.event_name == 'push' && github.ref == 'refs/heads/dev'
needs: build
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Extract version name
shell: bash
run: echo "version=$(grep '^[[:space:]]*version[[:space:]]*=' gradle.properties | sed 's/^[[:space:]]*version[[:space:]]*=[[:space:]]*//' | sed 's/-SNAPSHOT$//')" >> $GITHUB_OUTPUT
id: extract_version
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
# GitHub Releases require a tag
- name: Delete release if exist then create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release view "snapshot" && gh release delete "snapshot" -y --cleanup-tag || true
gh release create "snapshot" "./dist/*" -p -t "CD4Analysis ${{ steps.extract_version.outputs.version }} SNAPSHOT" --generate-notes
tag-release:
name: Release
runs-on: ubuntu-latest
# Only upload release on tag
if: github.repository_owner == 'MontiCore' && startsWith(github.ref, 'refs/tags/')
needs: build
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Extract version name
shell: bash
run: echo "version=$(grep '^[[:space:]]*version[[:space:]]*=' gradle.properties | sed 's/^[[:space:]]*version[[:space:]]*=[[:space:]]*//' | sed 's/-SNAPSHOT$//')" >> $GITHUB_OUTPUT
id: extract_version
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ github.ref_name }}" "./dist/*" --verify-tag -d -t "CD4Analysis ${{ steps.extract_version.outputs.version }}" --generate-notes