-
Notifications
You must be signed in to change notification settings - Fork 51
80 lines (67 loc) · 2.44 KB
/
main.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
name: Build DCM Project and Create Release
on:
push:
branches:
- actions # Triggers on push to the 'actions' branch
tags:
- '*' # Triggers on any tag creation (for release)
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
distribution: 'temurin' # You can change this to another JDK distribution if needed
java-version: '8'
- name: Install Apache Ant 1.9.9
run: |
wget https://archive.apache.org/dist/ant/binaries/apache-ant-1.9.9-bin.zip
unzip apache-ant-1.9.9-bin.zip
sudo mv apache-ant-1.9.9 /usr/local/ant
echo "export PATH=\$PATH:/usr/local/ant/bin" >> $GITHUB_ENV
- name: Verify Ant installation
run: ant -version
- name: Set build version
run: echo "VERSION=${GITHUB_REF#refs/tags/}.${GITHUB_SHA:0:7}" >> $GITHUB_ENV
- name: Build the project
env:
VERSION: ${{ env.VERSION }}
run: ant -Dplugin.version=${{ env.VERSION }}
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
dist/datapower-v*.zip
dist/dcm.jar
release:
runs-on: ubuntu-20.04
needs: build # Release job depends on successful completion of build job
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create GitHub release
id: create_release # Add an ID to this step
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }} # Use the tag name directly
release_name: "Release ${{ github.ref_name }}" # Use the tag name for the release
body: |
Release notes for ${{ github.ref_name }}.
- Plugin version: ${{ env.VERSION }}
draft: false
prerelease: false
- name: Upload release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # Reference the output from create_release step
asset_path: dist/datapower-v${{ env.VERSION }}.zip
asset_name: datapower-v${{ env.VERSION }}.zip
asset_content_type: application/zip