Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CTM-1130] implement workflow to create a GH release #11

Merged
merged 16 commits into from
Apr 26, 2024
15 changes: 13 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Build

on:
workflow_dispatch:
workflow_call:
pull_request:

jobs:
Expand All @@ -23,6 +24,16 @@ jobs:
echo "Found version: $VERSION"
echo "marketing_build_version=$VERSION" >> $GITHUB_OUTPUT

- name: Write version to file
run: |
echo "${{ steps.decide_build_number.outputs.marketing_build_version }}" > version.txt

- name: Upload version
uses: actions/upload-artifact@v3
with:
name: version
path: version.txt

- name: Invoke Gradle for aar
run: |
chmod +x gradlew
Expand All @@ -33,7 +44,7 @@ jobs:
env:
MARKETING_VERSION: ${{ steps.decide_build_number.outputs.marketing_build_version }}
with:
name: 'cumulocity-clients-kotlin-${{ env.MARKETING_VERSION }}'
name: 'cumulocity-clients-kotlin-aar'
path: 'build/outputs/aar/*.aar'

- name: Invoke Gradle for jar
Expand All @@ -46,5 +57,5 @@ jobs:
env:
MARKETING_VERSION: ${{ steps.decide_build_number.outputs.marketing_build_version }}
with:
name: 'cumulocity-clients-kotlin-${{ env.MARKETING_VERSION }}'
name: 'cumulocity-clients-kotlin-jar'
path: 'build/libs/*.jar'
52 changes: 50 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,66 @@ jobs:
uses: ./.github/workflows/build.yml

release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Download version
uses: actions/download-artifact@v3
with:
name: version

- name: Set version as env variable
id: set_build_number
run: |
echo "marketing_build_version=$(cat version.txt)" >> $GITHUB_ENV

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: TODOextractVersion
release_name: Release ${{ github.ref_name }}
tag_name: v${{ env.marketing_build_version }}
release_name: Release ${{ env.marketing_build_version }}
body: |
New release of the generated Kotlin client.
draft: false
prerelease: false

- name: Download aar artifact
uses: actions/download-artifact@v3
with:
name: cumulocity-clients-kotlin-aar
path: artifacts

- name: Download jar artifact
uses: actions/download-artifact@v3
with:
name: cumulocity-clients-kotlin-jar
path: artifacts

- name: show downloaded content
run: |
ls -lsa artifacts/

- name: Upload aar to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: "cumulocity-clients-kotlin-release.aar"
asset_path: artifacts/cumulocity-clients-kotlin-release-${{ env.marketing_build_version }}.aar
asset_content_type: application/zip

- name: Upload jar to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: "cumulocity-clients-kotlin-${{ env.marketing_build_version }}.jar"
asset_path: artifacts/cumulocity-clients-kotlin-${{ env.marketing_build_version }}.jar
asset_content_type: application/zip
MarkJMReynolds-SAG marked this conversation as resolved.
Show resolved Hide resolved
Loading