Skip to content

Commit

Permalink
Update Release workflows (#163)
Browse files Browse the repository at this point in the history
* Update Release workflows
* Update docs
  • Loading branch information
a4z authored Jan 1, 2024
1 parent b2a9f83 commit 719e0a7
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 51 deletions.
57 changes: 46 additions & 11 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@ 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
~/.ivy2
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
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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
85 changes: 56 additions & 29 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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 := {}
)
4 changes: 2 additions & 2 deletions docs/developer-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<MAJOR>.<MINOR>.<PATCH>`) 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).
21 changes: 13 additions & 8 deletions docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ asdf install djinni latest

#### MacOS homebrew

We have a brew tap!
We have a brew tap.

Add the tap:

Expand All @@ -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.

0 comments on commit 719e0a7

Please sign in to comment.