diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 2debda0..e4576fe 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -11,9 +11,9 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Caching dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ~/.sbt @@ -21,16 +21,16 @@ jobs: key: scala-build-deps - name: Building run: sbt assembly - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: djinni-generator path: target/bin/djinni formatCheck: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Caching dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.sbt key: scala-fmt-deps @@ -42,15 +42,15 @@ jobs: runs-on: ubuntu-latest needs: [build, formatCheck] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Caching dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ~/.sbt ~/.ivy2 key: scala-build-deps - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4 with: name: djinni-generator path: target/bin @@ -59,17 +59,50 @@ jobs: - name: Running integration-tests run: sbt IntegrationTest/test + buildWindows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - name: Caching dependencies + uses: actions/cache@v3 + with: + path: | + ~/.sbt + ~/.ivy2 + key: scala-build-deps-windows + - name: Building + run: sbt assembly + - name: Testing + run: sbt IntegrationTest/test + - uses: actions/upload-artifact@v4 + with: + name: djinni-generator.bat + path: target/bin/djinni.bat + + publishPreRelease: runs-on: ubuntu-latest - needs: [it] + needs: [it, buildWindows] if: github.ref == 'refs/heads/main' steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4 with: name: djinni-generator path: target/bin - name: Restoring file permissions of artifact run: chmod u+x target/bin/djinni + - name: Execute djinni-generator + run: target/bin/djinni --version + - name: Generate sha256sum + run: sha256sum target/bin/djinni > target/bin/djinni.sha256 + - uses: actions/download-artifact@v4 + with: + name: djinni-generator.bat + path: target/bin + - name: Execute djinni-generator.bat + run: sh target/bin/djinni.bat --version + - name: Generate sha256sum + run: sha256sum target/bin/djinni.bat > target/bin/djinni.bat.sha256 - uses: "marvinpinto/action-automatic-releases@latest" with: title: "Latest development build" @@ -78,4 +111,6 @@ jobs: automatic_release_tag: current-latest files: | target/bin/djinni - + target/bin/djinni.sha256 + target/bin/djinni.bat + target/bin/djinni.bat.sha256 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ab3d12a..dff4365 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,44 +6,71 @@ on: name: Upload Release Assets jobs: - build: - name: Upload Release Assets + buildUnix: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Caching dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: - fetch-depth: 0 path: | ~/.sbt ~/.ivy2 key: scala-build-deps - name: Building run: sbt assembly - - name: creating bat - run: cp target/bin/djinni target/bin/djinni.bat - - name: get upload-url for latest release - run: | - echo "UPLOAD_URL=$(curl -sL https://api.github.com/repos/${{github.repository}}/releases/latest | jq -r '.upload_url')" >> $GITHUB_ENV - shell: bash - - name: Upload Release Asset for macOS/Linux - id: upload-release-asset-unix - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/upload-artifact@v4 with: - upload_url: ${{ env.UPLOAD_URL }} - asset_path: target/bin/djinni - asset_name: djinni - asset_content_type: application/octet-stream - - name: Upload Release Asset for Windows - id: upload-release-asset-windows - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + name: djinni-generator + path: target/bin/djinni + + buildWindows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - name: Caching dependencies + uses: actions/cache@v3 + with: + path: | + ~/.sbt + ~/.ivy2 + key: scala-build-deps-windows + - name: Building + run: sbt assembly + - uses: actions/upload-artifact@v4 + with: + name: djinni-generator.bat + path: target/bin/djinni.bat + + publishRelease: + runs-on: ubuntu-latest + needs: [buildUnix, buildWindows] + steps: + - uses: actions/download-artifact@v4 + with: + name: djinni-generator + path: target/bin + - name: Make unix artifact executable + run: chmod u+x target/bin/djinni + - name: Execute djinni-generator + run: target/bin/djinni --version + - name: Generate sha256sum + run: sha256sum target/bin/djinni > target/bin/djinni.sha256 + - uses: actions/download-artifact@v4 with: - upload_url: ${{ env.UPLOAD_URL }} - asset_path: target/bin/djinni.bat - asset_name: djinni.bat - asset_content_type: application/bat + name: djinni-generator.bat + path: target/bin + - name: Execute djinni-generator.bat + run: sh target/bin/djinni.bat --version + - name: Generate sha256sum + run: sha256sum target/bin/djinni.bat > target/bin/djinni.bat.sha256 + - name: Publish Release + uses: softprops/action-gh-release@v1 + with: + files: | + target/bin/djinni + target/bin/djinni.sha256 + target/bin/djinni.bat + target/bin/djinni.bat.sha256 + +# TODO create PR for brew tap and scoop bucket diff --git a/build.sbt b/build.sbt index 024c981..ed204fe 100644 --- a/build.sbt +++ b/build.sbt @@ -31,6 +31,6 @@ lazy val djinni = (project in file(".")) dir / s"${(assembly / assemblyJarName).value}${binExt}" }, assembly / assemblyJarName := s"${name.value}", - assembly / assemblyPrependShellScript := Some(defaultUniversalScript(shebang = true)), + assembly / assemblyPrependShellScript := Some(defaultUniversalScript(shebang = binExt.isEmpty)), assembly / test := {} ) diff --git a/docs/developer-guide.md b/docs/developer-guide.md index 72d3cd1..d0cdd11 100644 --- a/docs/developer-guide.md +++ b/docs/developer-guide.md @@ -152,5 +152,5 @@ To release a new version of the generator, the following steps must be followed: 1. Create a [new release](https://github.com/cross-language-cpp/djinni-generator/releases/new) on Github. Set a tag version following [semantic versioning](https://semver.org/) rules (`v..`) and describe what has changed in the new version. 2. Wait. The [Github "release" Action](https://github.com/cross-language-cpp/djinni-generator/blob/main/.github/workflows/release.yaml) will automatically build the project and upload the resulting binaries to the release. -3. Create a PR to the [conan-center-index](https://github.com/conan-io/conan-center-index/tree/master/recipes/djinni-generator) to publish the new version to [Conan Center](https://conan.io/center/djinni-generator). -4. Update the [homebrew tap](https://github.com/cross-language-cpp/brew) to make it point to the newest version [here](https://github.com/cross-language-cpp/brew/blob/main/Casks/djinni.rb#L2). +3. Update the [homebrew tap](https://github.com/cross-language-cpp/brew) to make it point to the newest version [here](https://github.com/cross-language-cpp/brew/blob/main/Casks/djinni.rb#L2). +4. Update the [scoop bucket](https://github.com/cross-language-cpp/djinni-bucket) to make it point to the newest version [here](https://github.com/cross-language-cpp/djinni-bucket/blob/main/bucket/djinni-generator.json). diff --git a/docs/setup.md b/docs/setup.md index 0094acd..9a8117c 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -21,7 +21,7 @@ asdf install djinni latest #### MacOS homebrew -We have a brew tap! +We have a brew tap. Add the tap: @@ -35,17 +35,22 @@ Install the djinni generator: brew install djinni ``` -### Windows +### Windows manually + +You can download the generator manually and place it in your `PATH` [![GitHub release (latest by date)](https://img.shields.io/github/v/release/cross-language-cpp/djinni-generator?label=Download&logo=windows&style=for-the-badge)](https://github.com/cross-language-cpp/djinni-generator/releases/latest/download/djinni.bat) +### Windows via Scoop + +You can use the [scoop package manager](https://scoop.sh/). + +We maintain a [djinni bucket](https://github.com/cross-language-cpp/djinni-bucket), the [README contains instructions on how to add it to scoop](https://github.com/cross-language-cpp/djinni-bucket/blob/main/README.md). + ### Conan -The generator is available at [conan-center](https://conan.io/center/djinni-generator) for Windows, Linux & macOS. +Please note that the Conan recipe is not maintained by us but by the Conan community. -Add the generator as a build requirement in `conanfile.txt`: +The generator is available at the [conan-center](https://conan.io/center/djinni-generator) for Windows, Linux & macOS. -```text -[build_requires] -djinni-generator/1.3.0 -``` +Add the generator as a build requirement in `conanfile.txt` or your `conanfile.py` and it will be available for you.