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

feat: add release workflow and commit linting #2

Merged
merged 15 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions .github/actions/install-yq/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "Install yq"

description: "Downloads and installs yq"

runs:
using: "composite"
steps:
- name: "πŸ“¦ Install yq"
run: |
sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq
sudo chmod +x /usr/bin/yq
shell: bash
25 changes: 25 additions & 0 deletions .github/actions/use-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Use Flutter Dependencies"

description: "Installs the Flutter SDK and a project dependencies with caching."

runs:
using: "composite"
steps:
- name: "β˜• Set up Java"
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "zulu"
- name: "πŸ”§ Setup"
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
flutter-version: 3.22.3
pub-cache-key: "flutter-pub:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache of dart pub get dependencies
pub-cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
- name: "πŸ“¦ Install"
run: flutter pub get
shell: bash
Binary file added .github/assets/create_doppler_config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/logo@191x64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--
The title should summarise what the purpose of this change,

⚠️**NOTE:** The title must conform to the conventional commit message format outlined in CONTRIBUTING.md document, at the root of the project. This is to ensure the merge commit to the main branch is picked up by the CI and creates an entry in the CHANGELOG.md.
-->

# Description
<!-- Describe your changes in detail -->

# Type of change
<!-- What type of change does this change introduce? Put an 'x' in all the boxes that apply. -->

- [ ] πŸ’₯ Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] πŸ—οΈ Build configuration (CI configuration, scaffolding etc.)
- [ ] πŸ› Bug fix (non-breaking change which fixes an issue)
- [ ] πŸ“ Documentation update(s)
- [ ] πŸ“¦ Dependency update(s)
- [ ] πŸ‘©πŸ½β€πŸ’» Improve developer experience
- [ ] ⚑ Improve performance
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] β™» Refactor
- [ ] βͺ Revert changes
- [ ] πŸ§ͺ New tests or updates to existing tests
12 changes: 12 additions & 0 deletions .github/workflows/beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "Deploy - Beta"

on:
release:
types: [prereleased] # triggered on beta branch releases

jobs:
deploy:
name: "πŸš€ Deploy"
uses: ./.github/workflows/deploy.yml
with:
environment: "beta"
28 changes: 28 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Deploy"

on:
workflow_call:
inputs:
environment:
required: true
type: string

jobs:
deploy_to_play_store:
name: "Deploy To The Play Store"
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
- name: "πŸ›Ž Checkout"
uses: actions/checkout@v4
- name: "πŸ”§ Setup"
uses: ./.github/actions/use-dependencies
- name: "πŸ”‘ Create Android signing keys"
env:
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
ANDROID_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
run: ./scripts/create_android_signing_keys.sh
- name: "πŸ—οΈ Build AppBundle"
run: flutter build appbundle --release
65 changes: 65 additions & 0 deletions .github/workflows/pull_request_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: "Pull Request Checks"

on:
pull_request:

jobs:
##
# install
##

install:
name: "Install"
runs-on: ubuntu-latest
steps:
- name: "πŸ›Ž Checkout"
uses: actions/checkout@v4
- name: "πŸ”§ Setup"
uses: ./.github/actions/use-dependencies

##
# validation
##

validate_pr_title:
name: "Validate PR Title"
runs-on: ubuntu-latest
steps:
- name: "πŸ›Ž Checkout"
uses: actions/checkout@v4
- name: "πŸ”§ Setup"
uses: ./.github/actions/use-dependencies
- name: "βœ… Validate"
run: echo ${{ github.event.pull_request.title }} | dart run commitlint_cli

##
# build
##

build_android:
name: "Build Android"
needs: [validate_pr_title]
runs-on: ubuntu-latest
environment: development
steps:
- name: "πŸ›Ž Checkout"
uses: actions/checkout@v4
- name: "πŸ”§ Setup"
uses: ./.github/actions/use-dependencies
- name: "πŸ—οΈ Build APK"
run: flutter build apk --debug
- name: "πŸ—οΈ Build AppBundle"
run: flutter build appbundle --debug

# build_ios:
# name: "Build iOS"
# needs: [validate_pr_title]
# runs-on: macos-latest
# environment: development
# steps:
# - name: "πŸ›Ž Checkout"
# uses: actions/checkout@v4
# - name: "πŸ”§ Setup"
# uses: ./.github/actions/use-dependencies
# - name: "πŸ—οΈ Build ios"
# run: flutter build ios --release --no-codesign
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "Release"

on:
push:
branches:
- beta
- main

jobs:
release:
name: "Release"
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
runs-on: ubuntu-latest
environment: production
steps:
- name: "πŸ›Ž Checkout"
uses: actions/checkout@v4
- name: "πŸ“¦ Install yq"
uses: ./.github/actions/install-yq
- name: "πŸ”§ Setup"
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: "πŸ“¦ Install"
run: |
yarn add semantic-release @semantic-release/{changelog,commit-analyzer,exec,git,github,release-notes-generator}
- name: "πŸ”– Release"
env:
# appears on the release commits
GIT_AUTHOR_NAME: agoralabs-bot
GIT_AUTHOR_EMAIL: tech@agoralabs.sh
GIT_COMMITTER_NAME: agoralabs-bot
GIT_COMMITTER_EMAIL: tech@agoralabs.sh
# used to push the release commit and create the tags
GITHUB_TOKEN: ${{ secrets.WRITE_REPOS_TOKEN }}
run: yarn semantic-release
156 changes: 154 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,161 @@
# Miscellaneous
### macOS template
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Windows template
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

### VisualStudioCode template
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/

### Linux template
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
Expand Down
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

dart run commitlint_cli --edit "$1"
Loading
Loading