Skip to content

Commit

Permalink
feat: add release workflow and commit linting (#2)
Browse files Browse the repository at this point in the history
* build(deps): add commitlint_cli and jusky packages

* build: add commit message hook to lint commit messages

* ci: add pull request workflow

* docs: add contributing guide

* chore: update gitignore

* ci: add release workflow that updates version in yaml

* feat: add nunito fints

* refactor: rename license to copying

* fix: move kotlin version to global gradle file

* docs: add readme and repo assets

* chore: squash

* chore: squash

* ci: use a debug build for pr checks workflow

* docs: update readme docs to incorporate keys

* ci: add partial implementation of deployment on release
  • Loading branch information
kieranroneill committed Aug 29, 2024
1 parent c41ab58 commit b369557
Show file tree
Hide file tree
Showing 36 changed files with 1,141 additions and 147 deletions.
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
37 changes: 37 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Deploy"

on:
workflow_call:
inputs:
environment:
required: true
type: string
secrets:
ANDROID_KEY_ALIAS:
required: true
ANDROID_KEY_PASSWORD:
required: true
ANDROID_KEYSTORE:
required: true
ANDROID_KEYSTORE_PASSWORD:
required: true

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
18 changes: 18 additions & 0 deletions .github/workflows/deploy_beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "Deploy - Beta"

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

jobs:
deploy:
name: "πŸš€ Deploy"
uses: ./.github/workflows/deploy.yml
with:
environment: "beta"
secrets:
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 }}

17 changes: 17 additions & 0 deletions .github/workflows/deploy_production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Deploy - Production"

on:
release:
types: [released] # triggered on main branch releases

jobs:
deploy:
name: "πŸš€ Deploy"
uses: ./.github/workflows/deploy.yml
with:
environment: "production"
secrets:
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 }}
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
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "Release"

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

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: ${{ inputs.environment }}
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
15 changes: 15 additions & 0 deletions .github/workflows/release_beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Release - Beta"

on:
push:
branches:
- beta

jobs:
deploy:
name: "πŸ”– Release"
uses: ./.github/workflows/release.yml
with:
environment: "beta"
secrets:
WRITE_REPOS_TOKEN: ${{ secrets.WRITE_REPOS_TOKEN }}
15 changes: 15 additions & 0 deletions .github/workflows/release_production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Release - Production"

on:
push:
branches:
- main

jobs:
deploy:
name: "πŸ”– Release"
uses: ./.github/workflows/release.yml
with:
environment: "production"
secrets:
WRITE_REPOS_TOKEN: ${{ secrets.WRITE_REPOS_TOKEN }}
Loading

0 comments on commit b369557

Please sign in to comment.