-
Notifications
You must be signed in to change notification settings - Fork 51
56 lines (47 loc) · 1.67 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
name: CI
on:
push:
branches:
- actions # Trigger this workflow on pushes to the "actions" branch
jobs:
build_and_release:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '8' # Use the appropriate JDK version
distribution: 'adopt' # Set the Java distribution
- name: Install Ant
run: sudo apt-get install -y ant
- name: Build the project
run: ant -Dskip.chkpii=y # Run the specified Ant command
- name: List files in dist directory
run: ls -l dist # Debugging step to list files
- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "actions-${{ github.sha }}" # Tag name format
release_name: "Release for actions-${{ github.sha }}" # Release name format
body: |
Release notes for actions-${{ github.sha }}.
draft: false
prerelease: false
- name: Upload release assets
run: |
for file in dist/*.zip; do
if [ -f "$file" ]; then
echo "Uploading $file"
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/zip" \
--data-binary @"$file" \
"${{ steps.create_release.outputs.upload_url }}&name=$(basename "$file")" \
|| echo "Failed to upload $file" # Added error handling
fi
done