Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

12 quality create a release upload mechanism #29

Merged
merged 16 commits into from
Oct 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM ghcr.io/gdscparuluniversity/flutterdevcontainer:latest

ENV DEVCONTAINER="true"
26 changes: 26 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
}
15 changes: 15 additions & 0 deletions .github/scripts/release_number.sh
Original file line number Diff line number Diff line change
@@ -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"
10 changes: 2 additions & 8 deletions .github/workflows/ci.yaml → .github/workflows/ci-pr-test.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
name: Habit Tracker App CI
on:
push:
branches:
- main
pull_request:
branches:
- main
on: pull_request


jobs:
@@ -28,4 +22,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
67 changes: 67 additions & 0 deletions .github/workflows/ci-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Habit Tracker App CI
on:
push:
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
- name: "Flutter clean | get | build"
run: |
flutter pub get
flutter clean
flutter build apk --release

- uses: actions/upload-artifact@v1
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 V0"
current_verision=0
}

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
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 }}
Loading