-
Notifications
You must be signed in to change notification settings - Fork 5
128 lines (122 loc) · 3.98 KB
/
build.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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: Continous Integration
on:
pull_request:
push:
branches:
- main
tags: 'v[0-9]+.[0-9]+.[0-9]+'
paths-ignore:
- './idea'
- 'README.md'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/**'
env:
java: 11
java-distribution: "temurin"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '${{ env.java }}'
distribution: '${{ env.java-distribution }}'
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Install Bamboo SDK
run: |
wget -q https://marketplace.atlassian.com/download/plugins/atlassian-plugin-sdk-tgz
mkdir opt
tar -xzf *plugin-sdk* -C opt
mv opt/*plugin-sdk* opt/atlassian-plugin-sdk
chmod a+x opt/atlassian-plugin-sdk/bin/*
chmod a+x opt/atlassian-plugin-sdk/apache-maven-*/bin/*
echo "opt/atlassian-plugin-sdk/bin" >> $GITHUB_PATH
opt/atlassian-plugin-sdk/bin/atlas-version
- name: Spotless
run: atlas-mvn -B spotless:check
- name: Build
run: atlas-package -DskipTests=true
- name: Copy artifact
run: mkdir staging && cp target/*.jar staging
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: plugin
path: staging
release:
needs: [build, test]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Get tag
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: Release ${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false
- name: Download pre-build artifact
uses: actions/download-artifact@v2
with:
name: plugin
path: staging
- name: Get artifact name
id: get_artifact_name
run: |
cd staging
echo ::set-output name=ARTIFACT::$(ls *.jar)
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: staging/${{ steps.get_artifact_name.outputs.ARTIFACT }}
asset_name: ${{ steps.get_artifact_name.outputs.ARTIFACT }}
asset_content_type: application/zip
test:
runs-on: ubuntu-latest
steps:
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '${{ env.java }}'
distribution: '${{ env.java-distribution }}'
- uses: actions/checkout@v4
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Install Bamboo SDK
run: |
wget -q https://marketplace.atlassian.com/download/plugins/atlassian-plugin-sdk-tgz
mkdir opt
tar -xzf *plugin-sdk* -C opt
mv opt/*plugin-sdk* opt/atlassian-plugin-sdk
chmod a+x opt/atlassian-plugin-sdk/bin/*
chmod a+x opt/atlassian-plugin-sdk/apache-maven-*/bin/*
echo "opt/atlassian-plugin-sdk/bin" >> $GITHUB_PATH
opt/atlassian-plugin-sdk/bin/atlas-version
- name: Unit tests
run: atlas-unit-test
- name: Integration tests
run: atlas-integration-test