From c18a2e179e5bef5e2e8ebae5eddd5d57866515f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zman-1x1=20=7C=20=E3=82=B5=20=E3=82=A4=20=E3=83=81?= =?UTF-8?q?=E3=83=A3=E3=83=A9=E3=83=B3?= Date: Mon, 10 Oct 2022 12:39:55 +0000 Subject: [PATCH 01/15] change artifact path flutter has special output folder for debug apks --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2082753..598900e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,4 +28,4 @@ jobs: - uses: actions/upload-artifact@v1 with: name: release-apk - path: build/app/outputs/apk/release/app-release.apk + path: build/app/outputs/flutter-apk/app-release.apk From 3bd9d39e635611a24c51692a6aa2754c354b6fa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zman-1x1=20=7C=20=E3=82=B5=20=E3=82=A4=20=E3=83=81?= =?UTF-8?q?=E3=83=A3=E3=83=A9=E3=83=B3?= Date: Mon, 10 Oct 2022 12:43:17 +0000 Subject: [PATCH 02/15] Simplify flutter build steps less lines and a name ------------ [QUALITY]: Create a release & upload mechanism #12 --- .github/workflows/ci.yaml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 598900e..0ca81f5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,13 +18,12 @@ jobs: with: java-version: "12.x" - uses: subosito/flutter-action@v2.6.1 - - - run: flutter pub get - - - run: flutter clean - - - run: flutter build apk --release - + - name: "Flutter clean | get | build" + run: | + flutter pub get + flutter clean + flutter build apk --release + - uses: actions/upload-artifact@v1 with: name: release-apk From 0e795f642754a5dfb66a2952561c0e153c2fcd42 Mon Sep 17 00:00:00 2001 From: saicharankandukuri Date: Sat, 15 Oct 2022 11:53:29 +0530 Subject: [PATCH 03/15] add devcontainer for development stuff #12 --- .devcontainer/Dockerfile | 3 +++ .devcontainer/devcontainer.json | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..1c46341 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,3 @@ +FROM ghcr.io/gdscparuluniversity/flutterdevcontainer:latest + +ENV DEVCONTAINER="true" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..a4f9733 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,26 @@ +{ + "name": "Ubuntu", + "build": { + "dockerfile": "Dockerfile", + // Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04 + // Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon. + "args": { "VARIANT": "ubuntu-22.04" } + }, + + "extensions": [ + "Dart-Code.flutter", + "alexisvt.flutter-snippets", + "lizebang.bash-extension-pack", + "shakram02.bash-beautify" + ], + + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "uname -a", + + // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode" +} From 911b40dc869c50082cd185611ea6b8f93b455b2a Mon Sep 17 00:00:00 2001 From: saicharankandukuri Date: Sat, 15 Oct 2022 14:20:28 +0530 Subject: [PATCH 04/15] upgraded workflow --- .github/workflows/ci.yaml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0ca81f5..ac5a8d4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,3 +28,40 @@ jobs: with: name: release-apk path: build/app/outputs/flutter-apk/app-release.apk + + - name: Compute release tag + run: | + repo_link="https://github.com/GDSCParulUniversity/Habit-Tracker-App" + + current_verision=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' \ + $repo_link | tail -n1 | cut -d / -f 3 | cut -d V -f 2-) + + [[ -z $current_verision ]] && { + echo "NO release found?" + echo "Fallback to V0000" + current_verision=init_version + } + + new_release="V$($current_verision + 1))" + echo "VERSIONTAG=$new_release" >> $GITHUB_ENV + + - name: Generate release notes + run: | + echo "Habit Tracker ${VERSIONTAG}" > release.md + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.VERSIONTAG }} + release_name: ${{ env.VERSIONTAG }} + body_path: release.md + draft: false + prerelease: false + + - name: Upload assets + run: | + set -x + hub release edit -F release.md -a build/app/outputs/flutter-apk/app-release.apk -m "$tag_name" "$tag_name" From a902e3006ff82049ddcdf0e542f2e7318ab9a628 Mon Sep 17 00:00:00 2001 From: saicharankandukuri Date: Sat, 15 Oct 2022 14:31:39 +0530 Subject: [PATCH 05/15] upgrade workflow --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ac5a8d4..d9f25e2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -39,7 +39,7 @@ jobs: [[ -z $current_verision ]] && { echo "NO release found?" echo "Fallback to V0000" - current_verision=init_version + current_verision=0000 } new_release="V$($current_verision + 1))" From b53f4f1985a12f86081dd3f6d6198fdf892e906c Mon Sep 17 00:00:00 2001 From: saicharankandukuri Date: Sat, 15 Oct 2022 16:03:29 +0530 Subject: [PATCH 06/15] add a string --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d9f25e2..bae33b8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -39,7 +39,7 @@ jobs: [[ -z $current_verision ]] && { echo "NO release found?" echo "Fallback to V0000" - current_verision=0000 + current_verision="0000" } new_release="V$($current_verision + 1))" From 30876b44353c9ed6755a63f1cfe34cce2b452b8e Mon Sep 17 00:00:00 2001 From: saicharankandukuri Date: Sat, 15 Oct 2022 16:13:40 +0530 Subject: [PATCH 07/15] add missing `(` --- .github/workflows/ci.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bae33b8..48084a1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -38,11 +38,11 @@ jobs: [[ -z $current_verision ]] && { echo "NO release found?" - echo "Fallback to V0000" - current_verision="0000" + echo "Fallback to V0" + current_verision=0 } - new_release="V$($current_verision + 1))" + new_release="V$(($current_verision + 1))" echo "VERSIONTAG=$new_release" >> $GITHUB_ENV - name: Generate release notes From 7499f89c7f3e058c4220095cfb4d856cc8f57e57 Mon Sep 17 00:00:00 2001 From: saicharankandukuri Date: Sat, 15 Oct 2022 16:20:38 +0530 Subject: [PATCH 08/15] fix version variable name --- .github/scripts/release_number.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/scripts/release_number.sh diff --git a/.github/scripts/release_number.sh b/.github/scripts/release_number.sh new file mode 100644 index 0000000..8ad3212 --- /dev/null +++ b/.github/scripts/release_number.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +repo_link="https://github.com/GDSCParulUniversity/Habit-Tracker-App" + +current_verision=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' \ + $repo_link | tail -n1 | cut -d / -f 3 | cut -d V -f 2-) + +[[ -z $current_verision ]] && { + echo "NO release found?" + echo "Fallback to V0000" + current_verision=00 +} + +new_release="V$(($current_verision + 1))" +echo "VERSIONTAG=$new_release" From bf2191498442665cb1f57c14704a9cc2fef08cfc Mon Sep 17 00:00:00 2001 From: saicharankandukuri Date: Sat, 15 Oct 2022 16:21:01 +0530 Subject: [PATCH 09/15] fix variable name --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 48084a1..59e0292 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -64,4 +64,4 @@ jobs: - name: Upload assets run: | set -x - hub release edit -F release.md -a build/app/outputs/flutter-apk/app-release.apk -m "$tag_name" "$tag_name" + hub release edit -F release.md -a build/app/outputs/flutter-apk/app-release.apk -m "$VERSIONTAG" "$VERSIONTAG" From 3704bc856c5a7a822d2e4710c3ff22bc4e51aa3a Mon Sep 17 00:00:00 2001 From: saicharankandukuri Date: Sat, 15 Oct 2022 16:28:56 +0530 Subject: [PATCH 10/15] add GITHUB_TOKEN for `hub` --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 59e0292..d1ccf19 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -65,3 +65,5 @@ jobs: run: | set -x hub release edit -F release.md -a build/app/outputs/flutter-apk/app-release.apk -m "$VERSIONTAG" "$VERSIONTAG" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From de6ff3a05c952f1b784fe81d6cce26fdc8d21500 Mon Sep 17 00:00:00 2001 From: saicharankandukuri Date: Sat, 15 Oct 2022 16:35:00 +0530 Subject: [PATCH 11/15] sleep for sometime Cause github takes some time to update new tag --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d1ccf19..25831de 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -64,6 +64,7 @@ jobs: - name: Upload assets run: | set -x + sleep 6 hub release edit -F release.md -a build/app/outputs/flutter-apk/app-release.apk -m "$VERSIONTAG" "$VERSIONTAG" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From fb7c3dcd1a1d166a4711218aee1c1da0a4eac820 Mon Sep 17 00:00:00 2001 From: saicharankandukuri Date: Sat, 15 Oct 2022 16:35:15 +0530 Subject: [PATCH 12/15] sleep for 10 seconds --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 25831de..eff3ac9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -64,7 +64,7 @@ jobs: - name: Upload assets run: | set -x - sleep 6 + sleep 10 hub release edit -F release.md -a build/app/outputs/flutter-apk/app-release.apk -m "$VERSIONTAG" "$VERSIONTAG" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 8440b0c07ccd365114052a7b1f0ca000bdd71d61 Mon Sep 17 00:00:00 2001 From: saicharankandukuri Date: Sat, 15 Oct 2022 16:36:57 +0530 Subject: [PATCH 13/15] modified: .github/workflows/ci.yaml --- .github/workflows/ci.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index eff3ac9..05bff8c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,9 +3,6 @@ on: push: branches: - main - pull_request: - branches: - - main jobs: From 5928870db0c7d61b1f0e49282a8254c09502547d Mon Sep 17 00:00:00 2001 From: saicharankandukuri Date: Sat, 15 Oct 2022 16:43:13 +0530 Subject: [PATCH 14/15] new workflow flow to test PR's --- .github/workflows/ci-pr-test.yaml | 31 +++++++++++++++++++ .../workflows/{ci.yaml => ci-release.yaml} | 0 pubspec.lock | 19 ++++++++---- 3 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/ci-pr-test.yaml rename .github/workflows/{ci.yaml => ci-release.yaml} (100%) diff --git a/.github/workflows/ci-pr-test.yaml b/.github/workflows/ci-pr-test.yaml new file mode 100644 index 0000000..598900e --- /dev/null +++ b/.github/workflows/ci-pr-test.yaml @@ -0,0 +1,31 @@ +name: Habit Tracker App CI +on: + push: + branches: + - main + pull_request: + branches: + - main + + +jobs: + flutter_build: + name: Run flutter build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: "12.x" + - uses: subosito/flutter-action@v2.6.1 + + - run: flutter pub get + + - run: flutter clean + + - run: flutter build apk --release + + - uses: actions/upload-artifact@v1 + with: + name: release-apk + path: build/app/outputs/flutter-apk/app-release.apk diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci-release.yaml similarity index 100% rename from .github/workflows/ci.yaml rename to .github/workflows/ci-release.yaml diff --git a/pubspec.lock b/pubspec.lock index 4681410..8a47f76 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -95,6 +95,13 @@ packages: description: flutter source: sdk version: "0.0.0" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.4" lints: dependency: transitive description: @@ -115,7 +122,7 @@ packages: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.5" + version: "0.2.0" meta: dependency: transitive description: @@ -155,7 +162,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.9.0" + version: "1.9.1" stack_trace: dependency: transitive description: @@ -169,7 +176,7 @@ packages: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" string_scanner: dependency: transitive description: @@ -190,14 +197,14 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.12" + version: "0.4.14" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.4" sdks: - dart: ">=2.17.6 <3.0.0" + dart: ">=2.18.0 <3.0.0" flutter: ">=1.16.0" From 867bf245070a12908097cd6cd1b820a67c590a23 Mon Sep 17 00:00:00 2001 From: saicharankandukuri Date: Sat, 15 Oct 2022 16:43:38 +0530 Subject: [PATCH 15/15] change trigger to all run on PR's --- .github/workflows/ci-pr-test.yaml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/ci-pr-test.yaml b/.github/workflows/ci-pr-test.yaml index 598900e..30eb79d 100644 --- a/.github/workflows/ci-pr-test.yaml +++ b/.github/workflows/ci-pr-test.yaml @@ -1,11 +1,5 @@ name: Habit Tracker App CI -on: - push: - branches: - - main - pull_request: - branches: - - main +on: pull_request jobs: