From 048bab287222a0f635e047df919e19ea86e13c57 Mon Sep 17 00:00:00 2001 From: Michael Voigt Date: Tue, 20 Feb 2024 14:12:10 +0100 Subject: [PATCH] use a file to transport version info from one workflow to another --- .github/workflows/build.yml | 14 ++++++++++++-- .github/workflows/release.yml | 19 +++++++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1089ce8..d7fefcc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,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 @@ -34,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 @@ -47,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' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 31ac284..d74dbde 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,16 @@ jobs: 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 + run: | + echo "marketing_build_version=$(cat version.txt)" >> $GITHUB_ENV + - name: Create Release id: create_release uses: actions/create-release@v1 @@ -27,14 +37,15 @@ jobs: prerelease: false - name: Download artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: + name: cumulocity-clients-kotlin-jar path: artifacts - name: Upload release asset uses: actions/upload-release-asset@v1 with: upload_url: ${{ steps.create-release.outputs.upload_url }} - asset_name: "cumulocity-clients-kotlin-${{ env.MARKETING_VERSION }}.aar" # Use full file name - asset_path: artifacts/cumulocity-clients-kotlin-${{ env.MARKETING_VERSION }}.aar # Adjust path - asset_content_type: application/zip # Assuming AAR is a ZIP-based format + asset_name: "cumulocity-clients-kotlin-${{ env.MARKETING_VERSION }}.jar" + asset_path: artifacts/cumulocity-clients-kotlin-${{ env.MARKETING_VERSION }}.jar + asset_content_type: application/zip