Skip to content

Commit

Permalink
Merge pull request LikeMindsCommunity#45 from LikeMindsCommunity/feat…
Browse files Browse the repository at this point in the history
…ure/LM-9809

Feature/LM-9809-CI-Implementation
  • Loading branch information
divyanshgandhilm authored Nov 9, 2023
2 parents 266b183 + 5d93cc4 commit 3b75915
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Feed SDK test on every PR

on:
pull_request:
branches-ignore:
- master

jobs:
run-flutter-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- run: flutter pub get

- name: Lint
run: flutter analyze > lint-results.txt

- name: Upload the lint results as an artifact
if: always()
uses: actions/upload-artifact@v2
with:
name: lint-results
path: lint-results.txt
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Create Tag and Release on Version Change

on:
push:
branches:
- master

permissions: write-all

jobs:
create_tag:
name: Create Git Tag
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Check for version changes
run: |
# Fetch all tags from the remote repository
git fetch --tags
# Get the previous version from the last release tag
export previous_version=$(git describe --tags --abbrev=0)
# Get the current version from pubspec.yaml
export current_version=$(cat pubspec.yaml | grep 'version:' | awk '{print $2}')
if [[ "$previous_version" != "v$current_version" ]]; then
echo "Version has changed from $previous_version to v$current_version."
else
echo "Version has not changed."
exit 1
fi
- name: Push Git Tag
run: |
# Git login
git config --global user.name "$(git log -n 1 --pretty=format:%an)"
git config --global user.email "$(git log -n 1 --pretty=format:%ae)"
# Push a Git tag with the new version
export current_version=$(cat pubspec.yaml | grep 'version:' | awk '{print $2}')
git tag -a "v$current_version" -m "Version $current_version"
git push origin "v$current_version"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

create-github-release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: create_tag
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Create Release
run: gh release create "$(git describe --tags --abbrev=0)" --generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27 changes: 27 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,30 @@ include: package:flutter_lints/flutter.yaml

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# Style rules
- camel_case_types
- library_names
- avoid_catches_without_on_clauses
- avoid_catching_errors
- avoid_empty_else
- unnecessary_brace_in_string_interps
- avoid_redundant_argument_values
- leading_newlines_in_multiline_strings
# formatting
- lines_longer_than_80_chars
- curly_braces_in_flow_control_structures
# doc comments
- slash_for_doc_comments

0 comments on commit 3b75915

Please sign in to comment.