guibranco/BancosBrasileiros

View on GitHub
appveyor.yml

Summary

Maintainability
Test Coverage
version: 6.0.{build}
skip_tags: true
skip_branch_with_pr: true
image: Visual Studio 2022

branches:
    only:
    - main

skip_commits:
    files:
    - .config/
    - .github/
    - examples/
    - schemas/
    - src/

environment:
  nodejs_version: 18
  npm_auth_token:
    secure: utvTJFeOvz8YUfgc/z87ERaWZs4tDNSAe/atkmUagrQjaxniSCqXn0Q4U1UVx1ST

install:
- ps: Install-Product node $env:nodejs_version
- choco install jq
- ps: >- 
    npm install --loglevel=error

    "//registry.npmjs.org/:_authToken=$env:npm_auth_token`n" | out-file "$env:userprofile\.npmrc" -Encoding ASCII
- choco install dart-sdk
- refreshenv

build_script:
- mkdir -p dist
- copy README.md dist\
- copy package.json dist\
- copy data\bancos.json dist\
- cd dist
- git config user.email "build@appveyor.com"
- git config user.name "AppVeyor"
- npm version %APPVEYOR_BUILD_VERSION% -m 'v%APPVEYOR_BUILD_VERSION%'
- npm publish
- cd ..
- cmd: nuget pack BancosBrasileiros.nuspec -Version %APPVEYOR_BUILD_VERSION%
- ps: $response=Invoke-RestMethod 'https://api.github.com/repos/guibranco/bancosbrasileiros/actions/artifacts?name=releaseNotesFile'
- ps: $releaseNotesUrl=$response.artifacts[0].archive_download_url
- ps: $headers = @{Authorization = "Bearer $env:GITHUB_TOKEN"}
- ps: Invoke-WebRequest -Uri $releaseNotesUrl -OutFile release-notes.zip -Headers $headers
- 7z x release-notes.zip
- ps: $env:release_notes=(Get-Content -Path "$pwd\release-notes.md" -Encoding UTF8 -Raw) -replace '\n', '\n'
- mkdir dart
- cd dart
- copy ..\analysis_options.yaml .
- copy ..\LICENSE .
- copy ..\pubspec.yaml .
- copy ..\README.md .
- mkdir example
- copy ..\examples\dart\bancos_brasileiros_example.dart example\
- mkdir assets
- copy ..\data\bancos.json assets\
- mkdir lib
- copy ..\lib\bancos_brasileiros.dart lib\
- cd lib
- mkdir src
- copy ..\..\lib\src\*.dart src\
- cd ..
- mkdir test
- copy ..\test\bancos_brasileiros_test.dart test\
- cd test
- mkdir resources
- copy ..\..\test\resources\*.json resources\
- cd ..
- ps: >-
    (Get-Content '.\pubspec.yaml') -replace "version: 1.0.0", "version: $env:APPVEYOR_BUILD_VERSION" | out-File '.\pubspec.yaml' -Encoding ASCII
- echo "## [%APPVEYOR_BUILD_VERSION%] - %RELEASE_NOTES%" > CHANGELOG.md
- C:\tools\dart-sdk\bin\dart pub get
- C:\tools\dart-sdk\bin\dart test
- C:\tools\dart-sdk\bin\dart pub publish --dry-run

artifacts:
- path: '**\*nupkg'
  name: Package

deploy:
- provider: NuGet
  api_key: $(NUGET_TOKEN)
  skip_symbols: false
  on:
   branch: main

- provider: GitHub
  on:
   branch: main
  tag: v$(appveyor_build_version)
  description: 'Release of Bancos Brasileiros - v$(appveyor_build_version) \n$(release_notes)'
  auth_token: $(GITHUB_TOKEN)
  force_update: true
  artifact: Package