Skip to content

fix(ci): set output for build number #13

fix(ci): set output for build number

fix(ci): set output for build number #13

Workflow file for this run

name: Release
on:
push:
tags:
- "*.*.*"
workflow_dispatch:
jobs:
version:
name: Get version
runs-on: ubuntu-latest
outputs:
version: ${{steps.version-generator.outputs.version}}
prev-version: ${{steps.version-generator.outputs.prev-version}}
build-number: ${{steps.version-generator.outputs.build-number}}
steps:
- uses: actions/checkout@v4
- name: Hack around https://github.com/actions/checkout/issues/290
run: |
git fetch --tags --force
- name: Get version, prev version and build number
id: version-generator
shell: bash
run: |
VERSION="$(git describe --tags)"
PREV_VERSION="$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1))"
echo "$VERSION"
echo "$PREV_VERSION"
echo ${{github.run_number}}
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "prev-version=$PREV_VERSION" >> "$GITHUB_OUTPUT"
echo "build-number=${{github.run_number}}" >> "$GITHUB_OUTPUT"
changelog:
name: Generate changelog
runs-on: ubuntu-latest
needs: version
outputs:
changelog: ${{steps.changelog-generator.outputs.changelog}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
cache: gradle
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Generate changelog
id: changelog-generator
run: |
dart pub global activate changelog_cli
echo "changelog=$(dart pub global run changelog_cli generate -P markdown -s ${{needs.version.outputs.prev-version}} -e ${{needs.version.outputs.version}})" > "$GITHUB_OUTPUT"
build-apk:
name: Build APK
runs-on: ubuntu-latest
needs: version
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
cache: gradle
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Update version in YAML
run: |
dart pub global activate cider
dart pub global run cider version ${{needs.version.outputs.version}}+${{needs.version.outputs.build-number}}
- name: Download Android keystore
id: android_keystore
uses: timheuer/[email protected]
with:
fileName: keystore.jks
encodedString: ${{ secrets.KEYSTORE_BASE64 }}
- name: Create key.properties
shell: bash
run: |
mkdir -p android
echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > android/key.properties
echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> android/key.properties
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties
- name: Get dependencies
run: flutter pub get
- name: Start Android Release Build
run: flutter build apk
- name: Rename apk
shell: bash
run: |
mv build/app/outputs/flutter-apk/app-release.apk io.github.kirasok.orioks.apk
- name: Upload Android Release
uses: actions/upload-artifact@v3
with:
name: android-release
path: io.github.kirasok.orioks.apk
build-linux:
name: Build linux package
runs-on: ubuntu-latest
needs: version
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
cache: gradle
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Update version in YAML
run: |
dart pub global activate cider
dart pub global run cider version ${{needs.version.outputs.version}}+${{needs.version.outputs.build-number}}
- name: install packages
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev libsecret-1-dev libjsoncpp-dev
- name: Configure Flutter for Linux
run: flutter config --enable-linux-desktop
- name: Start Linux Release Build
run: flutter build linux
- name: Zip Linux Release
uses: montudor/action-zip@v1
with:
args: zip -qq -r io.github.kirasok.orioks.zip build/linux/x64/release/bundle
- name: Upload Linux Release
uses: actions/upload-artifact@v3
with:
name: linux-release
path: io.github.kirasok.orioks.zip
deploy:
name: Deploy Android Build
needs: [build-apk, build-linux, changelog, version]
runs-on: ubuntu-latest
steps:
- name: Get artifacts
id: download
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Create Github Release
uses: softprops/[email protected]
with:
tag_name: ${{ needs.version.outputs.version }}
body: ${{needs.changelog.outputs.changelog}}
files: |
${{steps.download.outputs.download-path}}/**/*
build-web:
name: Create and Deploy Web Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
cache: gradle
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Get dependencies
run: flutter pub get
- name: Start Web Release Build
run: flutter build web --release --web-renderer auto --base-href /${{ github.event.repository.name }}/
- name: Deploy to Github Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: ./build/web # The folder the action should deploy.