-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from kushalmahapatro/fix/github-actions
build: github actions check added
- Loading branch information
Showing
33 changed files
with
258 additions
and
574 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Check Version | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
check-version: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get version | ||
id: yq | ||
uses: mikefarah/yq@master | ||
|
||
with: | ||
cmd: yq -r '.version' 'pubspec.yaml' | ||
|
||
- name: Print version | ||
run: echo ${{ steps.yq.outputs.result }} | ||
|
||
- name: Get Latest Tag | ||
id: get_tag | ||
run: | | ||
REPO_NAME=${{ github.repository }} | ||
LATEST_TAG=$(curl -s "https://api.github.com/repos/$REPO_NAME/releases" | jq -r '.[0].tag_name') | ||
echo "latest=${LATEST_TAG}">> $GITHUB_OUTPUT | ||
- name: Print version | ||
run: echo "provided_version=${{ steps.yq.outputs.result }} and latest_tag=${{ steps.get_tag.outputs.latest }}" | ||
|
||
- name: Check Version | ||
id: check_version | ||
run: | | ||
latest_tag=${{ steps.get_tag.outputs.latest }} | ||
provided_tag=${{ steps.yq.outputs.result }} | ||
# Extract numerical version parts from the tags | ||
latest_version=$(echo "$latest_tag" | sed 's/v\?\([0-9.]*\)[-a-zA-Z]*$/\1/') | ||
provided_version=$(echo "$provided_tag" | sed 's/v\?\([0-9.]*\)[-a-zA-Z]*$/\1/') | ||
echo "latest_version=${latest_version} and provided_version=${provided_version}" | ||
echo "$provided_version" == "$latest_version" | ||
if [[ "$provided_version" == "$latest_version" ]]; then | ||
echo "Provided version is equal to latest version" | ||
echo "trigger_next_action=false">> $GITHUB_OUTPUT | ||
exit 1 | ||
elif [[ "$provided_version" < "$latest_version" ]]; then | ||
echo "Provided version is less than latest version" | ||
echo "trigger_next_action=false">> $GITHUB_OUTPUT | ||
exit 1 | ||
else | ||
echo "trigger_next_action=true">> $GITHUB_OUTPUT | ||
fi | ||
- name: Trigger Next Action | ||
run: echo "Trigger Next Action ${{ steps.check_version.outputs.trigger_next_action }}" | ||
env: | ||
TRIGGER_NEXT_ACTION: ${{ steps.check_version.outputs.trigger_next_action }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Commit Push | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- '*' | ||
|
||
env: | ||
flutter_version: "3.13.0" | ||
java_version: "12.x" | ||
|
||
permissions: | ||
contents: read | ||
issues: write | ||
pull-requests: write | ||
discussions: write | ||
|
||
jobs: | ||
|
||
check-branch: | ||
runs-on: ubuntu-latest | ||
name: Check branch | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Cache Flutter SDK | ||
uses: actions/cache@v3 | ||
with: | ||
path: /opt/hostedtoolcache/flutter | ||
key: ${{ runner.OS }}-flutter-install-cache-${{ env.flutter_version }} | ||
- uses: subosito/flutter-action@v2 | ||
with: | ||
flutter-version: ${{ env.flutter_version }} | ||
- run: flutter --version | ||
|
||
- name: Install dependencies | ||
run: dart pub get | ||
|
||
- name: Analyze project source | ||
run: dart analyze | ||
|
||
- name: Run tests | ||
run: dart test | ||
|
||
- name: Run dart publish (dry run) | ||
if: ${{ github.event.pull_request.base.ref == 'main' }} | ||
run: dart pub publish --dry-run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Trigger Create Tag and Publish Workflow on PR Merge | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
trigger-create-tag-and-publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check if PR is merged into main | ||
id: check_merged | ||
run: | | ||
if [ "${{ github.event.pull_request.merged }}" = "true" ] && [ "${{ github.event.pull_request.base.ref }}" = "main" ]; then | ||
echo "true" | ||
else | ||
echo "false" | ||
fi | ||
- name: Set trigger_create_tag_and_publish output | ||
id: set_output | ||
env: | ||
TRIGGER_CREATE_TAG_AND_PUBLISH: ${{ steps.check_merged.outputs.outputs.result}} | ||
run: echo "set-env:TRIGGER_CREATE_TAG_AND_PUBLISH=${{ steps.check_merged.outputs.outputs.result}}" >> $GITHUB_ENV |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.