Release v0.15.1 #41
Workflow file for this run
This file contains hidden or 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
| name: release | |
| run-name: Release ${{ github.ref_name }} | |
| on: | |
| push: | |
| tags: | |
| - "v[0-9]+.[0-9]+.[0-9]+*" | |
| permissions: | |
| packages: write | |
| contents: write | |
| jobs: | |
| prepare: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tag: ${{ steps.set_tag.outputs.tag }} | |
| prerelease: ${{ steps.is_prerelease.outputs.prerelease }} | |
| steps: | |
| - name: Set Tag | |
| id: set_tag | |
| run: | | |
| echo "tag=$(echo $GITHUB_REF | sed -n 's/refs\/tags\/v//p')" >> $GITHUB_OUTPUT | |
| - name: Is prerelease | |
| id: is_prerelease | |
| run: | | |
| if [[ "${{ steps.set_tag.outputs.tag }}" == *"-RC"* ]]; then | |
| echo "prerelease=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "prerelease=false" >> $GITHUB_OUTPUT | |
| fi | |
| publish-docker: | |
| uses: ./.github/workflows/publish-docker.yml | |
| needs: | |
| - prepare | |
| with: | |
| tag: ${{ needs.prepare.outputs.tag }} | |
| publish-java-libraries: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - publish-docker | |
| - prepare | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: "corretto" | |
| java-version: "17" | |
| - name: Dump version | |
| env: | |
| TAG: ${{ needs.prepare.outputs.tag }} | |
| run: sed -i "s/version=.*/version=${TAG}/g" gradle.properties | |
| - name: Tests | |
| run: ./gradlew sdk-java:test test-utils:test test-utils-container:test | |
| - name: Publish | |
| if: ${{ needs.prepare.outputs.prerelease == 'false' }} | |
| env: | |
| ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} | |
| ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }} | |
| ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }} | |
| ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }} | |
| run: > | |
| ./gradlew | |
| sdk-java:publishToSonatype | |
| test-utils:publishToSonatype | |
| test-utils-container:publishToSonatype | |
| closeAndReleaseSonatypeStagingRepository | |
| - name: Publish (prerelease) | |
| if: ${{ needs.prepare.outputs.prerelease == 'true' }} | |
| env: | |
| ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} | |
| ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }} | |
| ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }} | |
| ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }} | |
| run: > | |
| ./gradlew | |
| sdk-java:publishToSonatype | |
| test-utils:publishToSonatype | |
| test-utils-container:publishToSonatype | |
| closeSonatypeStagingRepository | |
| publish-java-server: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - publish-docker | |
| - prepare | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: "corretto" | |
| java-version: "24" | |
| - name: Dump version | |
| env: | |
| TAG: ${{ needs.prepare.outputs.tag }} | |
| run: sed -i "s/version=.*/version=${TAG}/g" gradle.properties | |
| - name: Tests | |
| run: ./gradlew server:test canary:test | |
| - name: Publish | |
| if: ${{needs.prepare.outputs.prerelease == 'false'}} | |
| env: | |
| ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} | |
| ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }} | |
| ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }} | |
| ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }} | |
| run: > | |
| ./gradlew | |
| server:publishToSonatype | |
| canary:publishToSonatype | |
| closeAndReleaseSonatypeStagingRepository | |
| - name: Publish (prerelease) | |
| if: ${{needs.prepare.outputs.prerelease == 'true'}} | |
| env: | |
| ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} | |
| ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }} | |
| ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }} | |
| ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }} | |
| run: > | |
| ./gradlew | |
| server:publishToSonatype | |
| canary:publishToSonatype | |
| closeSonatypeStagingRepository | |
| publish-sdk-python: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - publish-docker | |
| - prepare | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Dump version | |
| env: | |
| TAG: ${{ needs.prepare.outputs.tag }} | |
| run: sed -i "s/version = \".*\"/version = \"${TAG,,}\"/g" sdk-python/pyproject.toml | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.9" | |
| - name: Install Dependencies | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| pip install poetry | |
| - name: Tests | |
| working-directory: ./sdk-python | |
| run: | | |
| poetry install | |
| poetry run python -m unittest -v | |
| poetry build | |
| - name: Publish Package | |
| uses: pypa/[email protected] | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI_API_TOKEN }} | |
| packages-dir: ./sdk-python/dist/ | |
| publish-sdk-js: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - publish-docker | |
| - prepare | |
| env: | |
| working-directory: ./sdk-js | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup NodeJS | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: "https://registry.npmjs.org" | |
| cache: "npm" | |
| cache-dependency-path: ${{env.working-directory}} | |
| - name: Install dependencies | |
| working-directory: ${{env.working-directory}} | |
| run: npm ci | |
| - name: Run unit tests | |
| working-directory: ${{env.working-directory}} | |
| run: npm test | |
| - name: Use tag | |
| working-directory: ${{env.working-directory}} | |
| env: | |
| TAG: ${{ needs.prepare.outputs.tag }} | |
| run: cat package.json | jq -r ".version = \"${TAG}\"" | tee package.json | |
| - name: Build | |
| working-directory: ${{env.working-directory}} | |
| run: npm run build | |
| - name: Publish | |
| working-directory: ${{env.working-directory}} | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | |
| run: npm publish --access public | |
| publish-sdk-dotnet: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - publish-docker | |
| - prepare | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Dotnet | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "6" | |
| - name: Bump version | |
| env: | |
| TAG: ${{ needs.prepare.outputs.tag }} | |
| run: sed -i "s/<PackageVersion>.*<\/PackageVersion>/<PackageVersion>${TAG}<\/PackageVersion>/g" sdk-dotnet/LittleHorse.Sdk/LittleHorse.Sdk.csproj | |
| - name: Build Project | |
| run: dotnet build sdk-dotnet/LittleHorse.Sdk/LittleHorse.Sdk.csproj | |
| - name: Create Package | |
| run: dotnet pack --configuration Release sdk-dotnet/LittleHorse.Sdk/LittleHorse.Sdk.csproj | |
| - name: Publish Package to nuget.org | |
| run: dotnet nuget push --skip-duplicate sdk-dotnet/LittleHorse.Sdk/bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json | |
| env: | |
| NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }} | |
| build-lhctl: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.21.3" | |
| - name: Build | |
| uses: goreleaser/goreleaser-action@v6 | |
| with: | |
| args: release --clean --skip=announce,publish,validate | |
| - name: Upload release archive | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: lhctl | |
| path: dist/lhctl_*.* | |
| create-release: | |
| needs: | |
| - prepare | |
| - build-lhctl | |
| - publish-java-libraries | |
| - publish-java-server | |
| - publish-sdk-python | |
| - publish-sdk-js | |
| - publish-sdk-dotnet | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Generate a changelog | |
| uses: orhun/git-cliff-action@v4 | |
| id: git-cliff | |
| with: | |
| config: cliff.toml | |
| args: --verbose --current | |
| env: | |
| OUTPUT: CHANGELOG.md | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Create Release | |
| if: ${{ needs.prepare.outputs.prerelease == 'false' }} | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: gh release create ${{ github.ref_name }} -t ${{ github.ref_name }} -F CHANGELOG.md dist/lhctl_* | |
| - name: Create Pre Release | |
| if: ${{ needs.prepare.outputs.prerelease == 'true' }} | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: gh release create ${{ github.ref_name }} -t ${{ github.ref_name }} -F CHANGELOG.md dist/lhctl_* --prerelease |