Skip to content

Commit

Permalink
ci(semantic-release): configuration (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeshuaro committed Sep 25, 2023
1 parent 97b0af3 commit b18c952
Show file tree
Hide file tree
Showing 8 changed files with 4,039 additions and 13 deletions.
48 changes: 47 additions & 1 deletion .github/workflows/github_actions.yml
Expand Up @@ -5,7 +5,14 @@ on:
branches:
- main
pull_request:

workflow_dispatch:
schedule:
- cron: "0 0 * * SUN"

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true

jobs:
test:
name: Test
Expand Down Expand Up @@ -84,3 +91,42 @@ jobs:
echo The score $PERCENTAGE is too low, it must be at least $MIN_SCORE
exit 1
fi
semantic-release:
name: Semantic release
runs-on: ubuntu-latest
needs: [test, lint, analyze]
if: ${{ (github.ref == 'refs/heads/main') && (contains(fromJSON('["workflow_dispatch", "schedule"]'), github.event_name)) }}

steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Get project Flutter version 🏷️
id: fvm-config
uses: kuhnroyal/flutter-fvm-config-action@v1.2.0

- name: Setup Flutter 💻
uses: subosito/flutter-action@v2.10.0
with:
channel: ${{ steps.fvm-config.outputs.FLUTTER_CHANNEL }}
cache: true
cache-key: ${{ runner.os }}-flutter-${{ steps.fvm-config.outputs.FLUTTER_CHANNEL }}

- name: Setup Node 💻
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: yarn

- name: Install dependencies 📦
run: yarn

- name: Release 🚀
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
GOOGLE_SERVICE_ACCOUNT_KEY: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY }}
157 changes: 147 additions & 10 deletions .gitignore
@@ -1,6 +1,5 @@

# Created by https://www.toptal.com/developers/gitignore/api/dart,macos,flutter,androidstudio,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=dart,macos,flutter,androidstudio,visualstudiocode
# Created by https://www.toptal.com/developers/gitignore/api/macos,visualstudiocode,androidstudio,flutter,dart,node
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,visualstudiocode,androidstudio,flutter,dart,node

### Dart ###
# See https://www.dartlang.org/guides/libraries/private-files
Expand Down Expand Up @@ -123,9 +122,152 @@ Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

### Node Patch ###
# Serverless Webpack directories
.webpack/

# Optional stylelint cache

# SvelteKit build / generate output
.svelte-kit

### VisualStudioCode ###
.vscode/*
.vscode/settings.json
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
Expand All @@ -142,8 +284,6 @@ Temporary Items
.history
.ionide

# Support for Project snippet scope

### AndroidStudio ###
# Covers files to be ignored for android development using Android Studio.

Expand Down Expand Up @@ -177,7 +317,6 @@ local.properties
proguard/

# Log Files
*.log

# Android Studio
/*/build/
Expand Down Expand Up @@ -275,6 +414,4 @@ fabric.properties

!/gradle/wrapper/gradle-wrapper.jar

# End of https://www.toptal.com/developers/gitignore/api/macos,visualstudiocode,androidstudio,flutter,dart

*.mocks.dart
# End of https://www.toptal.com/developers/gitignore/api/macos,visualstudiocode,androidstudio,flutter,dart,node
1 change: 1 addition & 0 deletions .nvmrc
@@ -0,0 +1 @@
18.18
115 changes: 115 additions & 0 deletions .releaserc
@@ -0,0 +1,115 @@
{
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
"semantic-release-replace-plugin",
{
"replacements": [
{
"files": [
"README.md"
],
"from": "^ firestore_cache: \\^.*",
"to": " firestore_cache: ^${nextRelease.version}",
"results": [
{
"file": "README.md",
"hasChanged": true,
"numMatches": 1,
"numReplacements": 1
}
],
"countMatches": true
}
]
}
],
[
"semantic-release-pub",
{
"cli": "flutter"
}
],
[
"@semantic-release/npm",
{
"npmPublish": false
}
],
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md",
"package.json",
"pubspec.yaml",
"README.md"
]
}
],
[
"@semantic-release/github",
{
"releasedLabels": false
}
]
],
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "feature",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance Improvements"
},
{
"type": "revert",
"section": "Reverts"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "style",
"section": "Styles"
},
{
"type": "chore",
"section": "Miscellaneous Chores"
},
{
"type": "refactor",
"section": "Code Refactoring"
},
{
"type": "test",
"section": "Tests"
},
{
"type": "build",
"section": "Build System"
},
{
"type": "ci",
"section": "Continuous Integration"
}
]
}
}
20 changes: 20 additions & 0 deletions package.json
@@ -0,0 +1,20 @@
{
"name": "firestore_cache",
"version": "2.3.0",
"description": "A Flutter plugin for fetching Firestore documents with read from cache first then server",
"main": "index.js",
"repository": "https://github.com/zeshuaro/firestore_cache",
"author": "Joshua Tang <zeshuaro@gmail.com>",
"license": "MIT",
"engines": {
"node": ">=18.18.0"
},
"devDependencies": {
"@semantic-release/changelog": "6.0.3",
"@semantic-release/git": "10.0.1",
"conventional-changelog-conventionalcommits": "7.0.2",
"semantic-release": "22.0.1",
"semantic-release-pub": "0.2.2",
"semantic-release-replace-plugin": "1.2.7"
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,6 +1,6 @@
name: firestore_cache
description: A Flutter plugin for fetching Firestore documents with read from
cache first then server.
cache first then server
version: 2.3.0+1
homepage: https://github.com/zeshuaro/firestore_cache

Expand Down

0 comments on commit b18c952

Please sign in to comment.