Merge pull request #52 from tchvu3/dev #9
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
# Based on https://github.com/independo-gmbh/capacitor-voice-recorder/blob/master/.github/workflows/ci.yml | |
name: "CI" | |
on: | |
push: | |
branches: | |
- master | |
- dev | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
lint: | |
runs-on: macos-14 | |
name: "Linting" | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- uses: actions/checkout@v4 | |
- name: Restore Dependency Cache | |
id: cache-modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
node_modules | |
*/node_modules | |
key: ${{ runner.os }}-dependency-caching-${{ hashFiles('package.json', '*/package.json') }} | |
- run: npm ci | |
- run: npm run lint | |
verify-ios: | |
runs-on: macos-14 | |
name: "iOS Verification" | |
timeout-minutes: 30 | |
needs: | |
- lint | |
steps: | |
- run: sudo xcode-select --switch /Applications/Xcode_15.0.app | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- uses: actions/checkout@v4 | |
- name: Restore Dependency Cache | |
id: cache-modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
node_modules | |
*/node_modules | |
key: ${{ runner.os }}-dependency-caching-${{ hashFiles('package.json', '*/package.json') }} | |
- run: npm install | |
- run: npm run verify:ios | |
verify-android: | |
runs-on: ubuntu-latest | |
name: "Android Verification" | |
timeout-minutes: 30 | |
needs: | |
- lint | |
steps: | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'zulu' | |
- uses: actions/checkout@v4 | |
- name: Restore Dependency Cache | |
id: cache-modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
node_modules | |
*/node_modules | |
key: ${{ runner.os }}-dependency-caching-${{ hashFiles('package.json', '*/package.json') }} | |
- run: npm ci | |
- run: npm run verify:android | |
verify-web: | |
runs-on: ubuntu-latest | |
name: "Web Verification" | |
timeout-minutes: 30 | |
needs: | |
- lint | |
steps: | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- uses: actions/checkout@v4 | |
- name: Restore Dependency Cache | |
id: cache-modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
node_modules | |
*/node_modules | |
key: ${{ runner.os }}-dependency-caching-${{ hashFiles('package.json', '*/package.json') }} | |
- run: npm ci | |
- run: npm run verify:web | |
build: | |
runs-on: ubuntu-latest | |
name: "Build Plugin" | |
timeout-minutes: 30 | |
needs: | |
- verify-web | |
- verify-ios | |
- verify-android | |
steps: | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- uses: actions/checkout@v4 | |
- name: Restore Dependency Cache | |
id: cache-modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
node_modules | |
*/node_modules | |
key: ${{ runner.os }}-dependency-caching-${{ hashFiles('package.json', '*/package.json') }} | |
- run: npm ci | |
- run: npm run build | |
publish: | |
runs-on: ubuntu-latest | |
name: "Publish Plugin" | |
timeout-minutes: 30 | |
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 | |
id-token: write # to enable use of OIDC for npm provenance | |
needs: | |
- build | |
steps: | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- uses: actions/checkout@v4 | |
- name: Restore Dependency Cache | |
id: cache-modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
node_modules | |
*/node_modules | |
key: ${{ runner.os }}-dependency-caching-${{ hashFiles('package.json', '*/package.json') }} | |
- run: npm ci | |
- run: npm run prepublishOnly | |
- name: 'Semantic Release' | |
run: npx semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |