Skip to content

Commit

Permalink
ci(android & desktop): create release automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
Irineu333 committed Nov 9, 2024
1 parent d8866d9 commit deeda60
Showing 1 changed file with 178 additions and 0 deletions.
178 changes: 178 additions & 0 deletions .github/workflows/create-release.yml
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 }}

0 comments on commit deeda60

Please sign in to comment.