Skip to content

Commit

Permalink
use a file to transport version info from one workflow to another
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Voigt committed Feb 20, 2024
1 parent 72aa2ce commit 048bab2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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'
19 changes: 15 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 048bab2

Please sign in to comment.