Skip to content

Instantly share code, notes, and snippets.

@Warns
Created May 5, 2021 12:48
Show Gist options
  • Save Warns/d02df0f7b80dbc21b5d302a1e7010264 to your computer and use it in GitHub Desktop.
Save Warns/d02df0f7b80dbc21b5d302a1e7010264 to your computer and use it in GitHub Desktop.
sociallme-builder-10-march
#
name: CI
on:
# push:
# branches:
# - 3934
pull_request:
branches: [ develop ]
# on:
# push:
# tags:
# - '*'
# if: ${{ startsWith(github.ref, 'refs/tags/') }}
workflow_dispatch:
jobs:
version:
name: Create version
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
steps:
- uses: actions/checkout@v2
- name: Fetch unshallow
run: git fetch --prune --tags --unshallow
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: '5.2.x'
- name: Use GitVersion
id: gitversion # step id used as reference for output values
uses: gittools/actions/gitversion/execute@v0.9.7
- name: Create version.txt with nuGetVersion
run: echo ${{ steps.gitversion.outputs.nuGetVersion }} > version.txt
- name: Upload version.txt
uses: actions/upload-artifact@v2
with:
name: gitversion
path: version.txt
build:
name: Build APK and create release
needs: [ version ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
with:
flutter-version: '1.22.4'
- name: Get version.txt
uses: actions/download-artifact@v2
with:
name:
gitversion
- name: Create new file without newline char from version.txt
run: tr -d '\n' < version.txt > version1.txt
- name: Read version
id: version
uses: juliangruber/read-file-action@v1
with:
path: version1.txt
- name: Update version in YAML
run: sed -i 's/99.99.99+99/${{ steps.version.outputs.content }}+${{ github.run_number }}/g' pubspec.yaml
- run: flutter channel stable
- run: flutter update-packages --force-upgrade
- run: flutter pub get
- run: flutter build apk # --release --split-per-abi
- name: Create a release in Github
uses: ncipollo/release-action@v1
with:
artifacts: "build/app/outputs/apk/release/*.apk"
token: ${{ secrets.GH_TOKEN }}
tag: ${{ steps.version.outputs.content }}
commit: ${{ github.sha }}
allowUpdates: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment