Skip to content

Commit

Permalink
Merge pull request #4 from kushalmahapatro/release/v0.1.2
Browse files Browse the repository at this point in the history
Release/v0.1.2
  • Loading branch information
kushalmahapatro authored Sep 19, 2023
2 parents 157e004 + 23601e3 commit 0903d93
Show file tree
Hide file tree
Showing 18 changed files with 598 additions and 114 deletions.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
7 changes: 7 additions & 0 deletions .github/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
bug: hotfix/*
documentation: docs/*
feature: ['feature/*', 'feat/*']
fix: fix/*
chore: chore/*
path: path/*
build: build/*
10 changes: 10 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
categories:
- title: 'Enhancements'
labels:
- 'enhancement'
- title: 'Fixes'
labels:
- 'bug'
- 'security'
change-template: '* $TITLE — #$NUMBER'
template: $CHANGES
72 changes: 72 additions & 0 deletions .github/workflows/check_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Check Version

on:
workflow_call:
secrets:
TRIGGER_NEXT_ACTION:
required: true
description: 'Trigger Next Action'

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 }}"
echo "set-env:TRIGGER_NEXT_ACTION=${{ steps.check_version.outputs.trigger_next_action}}" >> $GITHUB_ENV
env:
TRIGGER_NEXT_ACTION: ${{ steps.check_version.outputs.trigger_next_action }}
47 changes: 47 additions & 0 deletions .github/workflows/commit_push.yml
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: flutter pub get

- name: Analyze project source
run: flutter analyze

- name: Run tests
run: flutter test

- name: Run dart publish (dry run)
if: ${{ github.event.pull_request.base.ref == 'main' }}
run: flutter pub publish --dry-run
70 changes: 70 additions & 0 deletions .github/workflows/create_tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Create Tag and Publish to pub.dev

on:
workflow_run:
workflows: ["Trigger Create Tag and Publish Workflow on PR Merge"]
types:
- completed

jobs:
placeholder-job:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Placeholder Step
run: echo "This is a placeholder job"

create-tag-and-publish:
permissions:
repository-projects: write
packages: write
contents: read
pull-requests: write

runs-on: ubuntu-latest
needs: [placeholder-job]

steps:
- 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: Create tag
uses: actions/github-script@v3
id: tagCreate
env:
TAG: 'v${{ steps.yq.outputs.result }}'
with:
github-token: ${{ github.token }}
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/v${{ steps.yq.outputs.result }}",
sha: context.sha
})
- name: Print tag update
run: echo ${{ steps.tagCreate.outputs.result }}

- name: Publish
uses: subosito/flutter-action@v2
with:
channel: 'stable'

- name: Flutter Version
run: flutter --version

- name: Publish to Dart Package
uses: k-paxian/[email protected]
with:
credentialJson: ${{ secrets.CREDENTIAL_JSON }}
flutter: true
skipTests: true
40 changes: 40 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# .github/workflows/publish.yml
name: Publish to pub.dev

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*' # tag pattern on pub.dev: 'v'

# Publish using custom workflow
jobs:
publish:
permissions:
id-token: write # Required for authentication using OIDC
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- run: flutter --version

- name: Install dependencies
run: flutter pub get

- name: Analyze project source
run: flutter analyze

- name: Run tests
run: flutter test

- name: Run dart publish (dry run)
run: flutter pub publish --dry-run

- name: Publish
uses: k-paxian/[email protected]
with:
credentialJson: ${{ secrets.CREDENTIAL_JSON }}
flutter: true
skipTests: true
35 changes: 35 additions & 0 deletions .github/workflows/pull_request_opened.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Pull Request

on:
pull_request:
types: [ opened, edited, reopened ]

permissions:
contents: read
issues: write
pull-requests: write
discussions: write

jobs:
assign_author:
name: Assign Author to the Pull Request
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Assign Author to the Pull Request
uses: technote-space/assign-author@6252488282b99652aef47451a353eb88aea24666

pr-labeler:
name: Label the PR based on the branch
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Label the Pull Request
uses: TimonVS/pr-labeler-action@bd0b592a410983316a454e3d48444608f028ec8e
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Loading

0 comments on commit 0903d93

Please sign in to comment.