-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (62 loc) · 1.77 KB
/
build-release.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
name: Build and Release
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "21"
- name: Build with Maven
run: mvn clean package
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: release-jar
path: target/*.jar
- name: Publish release to R2
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: 'us-east-1'
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_BUCKET_NAME }}
CF_ACCOUNT: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
RELEASE: ${{ github.ref_name }}
run: |
aws s3 cp target/ s3://${AWS_S3_BUCKET_NAME}/FileToPNG/releases/tag/${RELEASE}/ \
--recursive \
--exclude "*" \
--include "FileToPNG*.jar" \
--quiet \
--endpoint-url https://${CF_ACCOUNT}.eu.r2.cloudflarestorage.com
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: release-jar
path: target/
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ github.ref_name }}
draft: true
files: "target/*release.jar"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release Information
run: echo "Release ${{ steps.create_release.outputs.upload_url }}"