From b35efce4439606b09b2cb03654162f4472ae39bd Mon Sep 17 00:00:00 2001 From: Iacopo Ciao Date: Wed, 10 Apr 2024 17:23:18 +0200 Subject: [PATCH] ci: add semantic-release --- .github/workflows/dart.yml | 50 ++++++++++++++++++++++++++++++++++++++ .gitignore | 5 ++-- .releaserc | 35 ++++++++++++++++++++++++++ dist/.gitkeep | 0 makefile | 2 +- 5 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/dart.yml create mode 100644 .releaserc create mode 100644 dist/.gitkeep diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml new file mode 100644 index 0000000..05e0695 --- /dev/null +++ b/.github/workflows/dart.yml @@ -0,0 +1,50 @@ +name: Dart + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + compile: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, macos-latest ] + sdk: [ stable ] + steps: + - uses: actions/checkout@v4 + - uses: dart-lang/setup-dart@v1 + with: + sdk: ${{ matrix.sdk }} + + - name: Install dependencies + run: make install + - name: Build runners + run: make build_runner + - name: compile + run: make compile + - name: zip + uses: montudor/action-zip@v1 + with: + args: zip "{{matrix.os}}.zip" bin/devmy + - name: compile + run: rm devmy + release: + runs-on: ubuntu-latest + needs: [ compile ] + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "lts/*" + - name: Setup Semantic Release + run: npm i -g semantic-release @semantic-release/commit-analyzer @semantic-release/release-notes-generator semantic-release-dart @semantic-release/changelog @semantic-release/git @semantic-release/github + - name: Run Semantic Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: semantic-release diff --git a/.gitignore b/.gitignore index ce30ead..53ceaa2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,11 +4,12 @@ pubspec_overrides.yaml # See http://help.github.com/ignore-files/ for more about ignoring files. # Compiled output -/dist +/dist/devmy /tmp /out-tsc /bazel-out -/bin/devmy.exe +/bin +!/bin/devmy.dart # Node /node_modules diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..1522254 --- /dev/null +++ b/.releaserc @@ -0,0 +1,35 @@ +{ + "branches": [ + "main", + ], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "semantic-release-dart", + [ + "@semantic-release/github", + { + "assets": [ + { "path": "macos-latest.zip", "label": "MacOS distribution" }, + { "path": "ubuntu-latest.zip", "label": "Linux distribution" } + ] + } + ], + [ + "@semantic-release/changelog", + { + "changelogFile": "CHANGELOG.md" + } + ], + [ + "@semantic-release/git", + { + "assets": [ + "CHANGELOG.md", + "pubspec.yaml" + ], + "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" + } + ] + ] +} diff --git a/dist/.gitkeep b/dist/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/makefile b/makefile index f480c89..2e29239 100644 --- a/makefile +++ b/makefile @@ -6,6 +6,6 @@ install: build_runner: dart run build_runner build compile: - dart compile exe bin/devmy.dart + dart compile exe -o dist/devmy bin/devmy.dart activate: dart pub global activate -s path . --overwrite