forked from MCreator/MCreator
-
Notifications
You must be signed in to change notification settings - Fork 0
167 lines (158 loc) · 7.43 KB
/
deploy.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: Deploy binaries
on:
workflow_dispatch:
inputs:
release-type:
description: 'Release type (snapshot/release)'
required: true
default: 'snapshot'
jobs:
export1:
name: Build and Export (all but MacOS)
runs-on: ubuntu-latest
environment: production
permissions:
contents: write
id-token: write
outputs:
mcr_version: ${{ steps.determineExportVersion.outputs.mcr_version }}
mc_version: ${{ steps.determineExportVersion.outputs.mc_version }}
build_date: ${{ steps.determineExportVersion.outputs.build_date }}
steps:
- uses: actions/checkout@v4
- name: Verify Repository
if: github.repository != 'MCreator/MCreator' && github.repository != 'KlemenDEV/MCreator'
run: |
cat << EOF
⚠️Deploy action is only intended to be run from the official MCreator's repository. ⚠️
We do not allow custom distributions of the software under MCreator brand to be distributed publicly.
For more information, read LICENSE.txt.
EOF
exit 1
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21.0.4+7.0.LTS'
distribution: 'temurin'
- name: Install Dependencies
run: |
sudo apt-get install -y mkisofs nsis nsis-pluginapi
wget https://nsis.sourceforge.io/mediawiki/images/d/d3/LockedList.zip
sudo unzip LockedList.zip -d /usr/share/nsis/
- uses: google-github-actions/auth@a6e2e39c0a0331da29f7fd2c2a20a427e8d3ad1f
name: Authenticate to Google Cloud
with:
workload_identity_provider: ${{ secrets.GC_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ secrets.GC_PROJECT_ID }}
- uses: google-github-actions/setup-gcloud@98ddc00a17442e89a24bbf282954a3b65ce6d200
name: Set up Google Cloud SDK
- name: Build and Export Release Using Gradle
if: github.event.inputs.release-type == 'release'
env:
WIN_CERT_PEM: ${{ secrets.WIN_CERT_PEM }}
WIN_CERT_KEYNAME: ${{ secrets.WIN_CERT_KEYNAME }}
WIN_CERT_KEYSTORE: ${{ secrets.WIN_CERT_KEYSTORE }}
run: |
export WIN_CERT_STOREPASS="$(gcloud auth print-access-token)"
echo "$WIN_CERT_PEM" > codesign-chain.pem
xvfb-run -a ./gradlew generateExportReport exportWindows exportLinux
- name: Build and Export Snapshot Using Gradle
if: github.event.inputs.release-type == 'snapshot'
env:
WIN_CERT_PEM: ${{ secrets.WIN_CERT_PEM }}
WIN_CERT_KEYNAME: ${{ secrets.WIN_CERT_KEYNAME }}
WIN_CERT_KEYSTORE: ${{ secrets.WIN_CERT_KEYSTORE }}
run: |
export WIN_CERT_STOREPASS="$(gcloud auth print-access-token)"
echo "$WIN_CERT_PEM" > codesign-chain.pem
xvfb-run -a ./gradlew generateExportReport exportWindows exportLinux -Psnapshot=true
- name: Determine Export Version
id: determineExportVersion
run: |
MCR_VERSION=$(cat build/reports/export.txt | grep "mcreator=" | cut -d'=' -f2)
MC_VERSION=$(cat build/reports/export.txt | grep "minecraft=" | cut -d'=' -f2)
BUILD_DATE=$(cat build/reports/export.txt | grep "builddate=" | cut -d'=' -f2)
echo "MCR_VERSION=$MCR_VERSION" >> $GITHUB_ENV
echo "MC_VERSION=$MC_VERSION" >> $GITHUB_ENV
echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_ENV
echo "mcr_version=$MCR_VERSION" >> $GITHUB_OUTPUT
echo "mc_version=$MC_VERSION" >> $GITHUB_OUTPUT
echo "build_date=$BUILD_DATE" >> $GITHUB_OUTPUT
- name: Upload Binaries and Tag Release
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.MCR_VERSION }}
release_name: ${{ env.MCR_VERSION }}
prerelease: ${{ github.event.inputs.release-type == 'snapshot' }}
file_glob: true
file: build/export/*
body: >
### **Download: https://mcreator.net/download**
### Changelog: https://mcreator.net/changelog
<!--[[
{
"minecraft": "${{ env.MC_VERSION }}"
}
]]-->
overwrite: true
export2:
name: Build and Export (only MacOS)
needs: export1
runs-on: macos-latest
environment: production
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21.0.4+7.0.LTS'
distribution: 'temurin'
- name: Install Dependencies
run: |
brew install create-dmg
- name: Prepare Keychain
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.MACOS_CI_KEYCHAIN_PWD }}
MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.MACOS_NOTARIZATION_APPLE_ID }}
MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.MACOS_NOTARIZATION_TEAM_ID }}
MACOS_NOTARIZATION_PWD: ${{ secrets.MACOS_NOTARIZATION_PWD }}
run: |
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security set-keychain-settings -t 3600 -u build.keychain
security import certificate.p12 -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign -k ~/Library/Keychains/build.keychain
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain
xcrun notarytool store-credentials "notarytool-profile" --apple-id "$MACOS_NOTARIZATION_APPLE_ID" --team-id "$MACOS_NOTARIZATION_TEAM_ID" --password "$MACOS_NOTARIZATION_PWD"
- name: Build and Export Release Using Gradle
if: github.event.inputs.release-type == 'release'
env:
MACOS_CERTIFICATE_NAME: ${{ secrets.MACOS_CERTIFICATE_NAME }}
run: ./gradlew generateExportReport exportMac -Pbuilddate=${{ needs.export1.outputs.build_date }}
- name: Build and Export Snapshot Using Gradle
if: github.event.inputs.release-type == 'snapshot'
env:
MACOS_CERTIFICATE_NAME: ${{ secrets.MACOS_CERTIFICATE_NAME }}
run: ./gradlew generateExportReport exportMac -Psnapshot=true -Pbuilddate=${{ needs.export1.outputs.build_date }}
- name: Upload Binaries and Tag Release
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ needs.export1.outputs.mcr_version }}
release_name: ${{ needs.export1.outputs.mcr_version }}
prerelease: ${{ github.event.inputs.release-type == 'snapshot' }}
file_glob: true
file: build/export/*
body: >
### **Download: https://mcreator.net/download**
### Changelog: https://mcreator.net/changelog
<!--[[
{
"minecraft": "${{ needs.export1.outputs.mc_version }}"
}
]]-->
overwrite: true