-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(android & desktop): create release automatically
- Loading branch information
Showing
1 changed file
with
178 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
name: Create release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tagname: | ||
description: 'Version name' | ||
required: true | ||
default: 'v*.*.*' | ||
type: string | ||
|
||
jobs: | ||
build-linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup JDK | ||
# TODO: replace this once https://github.com/actions/setup-java/pull/637 gets merged. | ||
uses: gmitch215/setup-java@6d2c5e1f82f180ae79f799f0ed6e3e5efb4e664d | ||
with: | ||
java-version: '17' | ||
distribution: 'jetbrains' | ||
cache: 'gradle' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Package | ||
run: | | ||
./gradlew application:packageReleaseTarGz | ||
./gradlew application:packageReleaseDeb | ||
./gradlew application:packageReleaseRpm | ||
- name: Prepare packages | ||
run: | | ||
mkdir -p binaries | ||
mv application/build/distribution/*.tar.gz binaries/ | ||
mv application/build/compose/binaries/main-release/deb/*.deb binaries/ | ||
mv application/build/compose/binaries/main-release/rpm/*.rpm binaries/ | ||
- name: Upload packages | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: NeoRegex-linux | ||
path: binaries/* | ||
|
||
build-windows: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup JDK | ||
# TODO: replace this once https://github.com/actions/setup-java/pull/637 gets merged. | ||
uses: gmitch215/setup-java@6d2c5e1f82f180ae79f799f0ed6e3e5efb4e664d | ||
with: | ||
java-version: '17' | ||
distribution: 'jetbrains' | ||
cache: 'gradle' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Package exe | ||
run: ./gradlew application:packageReleaseExe | ||
|
||
- name: Upload | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: NeoRegex-windows | ||
path: application/build/compose/binaries/main-release/exe/*.exe | ||
|
||
build-macos: | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup JDK | ||
# TODO: replace this once https://github.com/actions/setup-java/pull/637 gets merged. | ||
uses: gmitch215/setup-java@6d2c5e1f82f180ae79f799f0ed6e3e5efb4e664d | ||
with: | ||
java-version: '17' | ||
distribution: 'jetbrains' | ||
cache: 'gradle' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Package dmg | ||
run: ./gradlew application:packageReleaseDmg | ||
|
||
- name: Upload dmg | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: NeoRegex-macos | ||
path: application/build/compose/binaries/main-release/dmg/*.dmg | ||
|
||
build-android: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'zulu' | ||
cache: 'gradle' | ||
|
||
- name: Setup Android SDK | ||
uses: android-actions/setup-android@v3 | ||
|
||
- name: Decode Keystore | ||
run: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > keystore.jks | ||
|
||
- name: Decode Properties | ||
run: echo "${{ secrets.KEYSTORE_PROPERTIES_BASE64 }}" | base64 --decode > keystore.properties | ||
|
||
- name: Build apk | ||
run: ./gradlew assembleRelease | ||
|
||
- name: Upload apk | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: NeoRegex-android | ||
path: application/build/outputs/apk/release/*.apk | ||
|
||
create-release: | ||
needs: [build-windows, build-android, build-linux, build-macos] | ||
runs-on: ubuntu-latest | ||
env: | ||
DOWNLOADS_PATH: ./downloaded-artifacts | ||
|
||
steps: | ||
- name: Download window | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: NeoRegex-windows | ||
path: ${{ env.DOWNLOADS_PATH }} | ||
|
||
- name: Download linux | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: NeoRegex-linux | ||
path: ${{ env.DOWNLOADS_PATH }} | ||
|
||
- name: Download macOS | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: NeoRegex-macos | ||
path: ${{ env.DOWNLOADS_PATH }} | ||
|
||
- name: Download android | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: NeoRegex-android | ||
path: ${{ env.DOWNLOADS_PATH }} | ||
|
||
- name: Test artifact download | ||
run: ls -R | ||
|
||
- name: Create tag | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: 'refs/tags/${{ github.event.inputs.tagname }}', | ||
sha: context.sha | ||
}) | ||
- name: Upload Assets | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
files: ${{ env.DOWNLOADS_PATH }}/* | ||
tag_name: ${{ github.event.inputs.tagname }} |