From dc0d609c5559e11191f3933f10290d3c9ca29879 Mon Sep 17 00:00:00 2001 From: shiipou Date: Wed, 7 May 2025 15:24:41 +0000 Subject: [PATCH 01/16] feat: add a zip artifact option to publish a zip --- .github/workflows/build-bun.yml | 23 +++++++++++++++++++++++ .github/workflows/build-flutter.yml | 25 +++++++++++++++++++++++++ .github/workflows/build-springboot.yml | 25 ++++++++++++++++++++++++- 3 files changed, 72 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-bun.yml b/.github/workflows/build-bun.yml index 69e6c6c..2c80a45 100644 --- a/.github/workflows/build-bun.yml +++ b/.github/workflows/build-bun.yml @@ -23,6 +23,11 @@ on: description: 'Path to the generated artifact to upload' required: false default: 'dist/' + zip-artifact: + type: boolean + description: 'Whether to produce a zip artifact alongside the build artifact' + required: false + default: false jobs: build: @@ -58,3 +63,21 @@ jobs: with: name: ${{ inputs.artifact-name }} path: ${{ inputs.working-directory }}/${{ inputs.artifact-path }} + - id: zip-artifact + name: Zip artifact + if: inputs.zip-artifact == 'true' + run: | + filename="${{ inputs.artifact-name }}" + zipname="${filename}.zip" + tmp_file="$(mktemp -d)/${zipname}" + zip -r "${tmp_file}" ${filename} + echo "Zipped artifact created: ${tmp_file}" + echo "filename=${zipname}" >> $GITHUB_OUTPUT + echo "filepath=${tmp_file}" >> $GITHUB_OUTPUT + - name: Upload zipped artifact + if: inputs.zip-artifact == 'true' + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.zip-artifact.outputs.filename }} + path: ${{ steps.zip-artifact.outputs.filepath }} + retention-days: 1 diff --git a/.github/workflows/build-flutter.yml b/.github/workflows/build-flutter.yml index fa59f10..96ec6d8 100644 --- a/.github/workflows/build-flutter.yml +++ b/.github/workflows/build-flutter.yml @@ -51,6 +51,11 @@ on: type: string description: 'Glob pattern for build artifacts' required: false + zip-artifact: + type: boolean + description: 'Whether to produce a zip artifact alongside the build artifact' + required: false + default: false secrets: UPLOAD_KEY_STORE: description: 'Keystore file content for Android signing' @@ -168,3 +173,23 @@ jobs: with: name: ${{ inputs.artifact-name }} path: ${{ inputs.working-directory }}/${{ inputs.artifact-path }} + + - id: zip-artifact + name: Zip artifact + if: inputs.zip-artifact == 'true' + run: | + filename="${{ inputs.artifact-name }}" + zipname="${filename}.zip" + tmp_file="$(mktemp -d)/${zipname}" + zip -r "${tmp_file}" ${filename} + echo "Zipped artifact created: ${tmp_file}" + echo "filename=${zipname}" >> $GITHUB_OUTPUT + echo "filepath=${tmp_file}" >> $GITHUB_OUTPUT + - name: Upload zipped artifact + if: inputs.zip-artifact == 'true' + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.zip-artifact.outputs.filename }} + path: ${{ steps.zip-artifact.outputs.filepath }} + retention-days: 1 + \ No newline at end of file diff --git a/.github/workflows/build-springboot.yml b/.github/workflows/build-springboot.yml index 5929e14..49037c0 100644 --- a/.github/workflows/build-springboot.yml +++ b/.github/workflows/build-springboot.yml @@ -28,6 +28,11 @@ on: description: 'Path to the generated artifact to upload' required: false default: 'build/libs/*.jar' + zip-artifact: + type: boolean + description: 'Whether to produce a zip artifact alongside the build artifact' + required: false + default: false envs: type: string description: 'Add extra env variable to the build, one value per line : =' @@ -46,7 +51,6 @@ jobs: steps: - uses: actions/checkout@v4 - - run: echo "${{ inputs.envs }}" >> .env - run: echo "${{ secrets.envs }}" >> .env @@ -67,3 +71,22 @@ jobs: with: name: ${{ inputs.artifact-name }} path: ${{ inputs.working-directory }}/${{ inputs.artifact-path }} + + - id: zip-artifact + name: Zip artifact + if: inputs.zip-artifact == 'true' + run: | + filename="${{ inputs.artifact-name }}" + zipname="${filename}.zip" + tmp_file="$(mktemp -d)/${zipname}" + zip -r "${tmp_file}" ${filename} + echo "Zipped artifact created: ${tmp_file}" + echo "filename=${zipname}" >> $GITHUB_OUTPUT + echo "filepath=${tmp_file}" >> $GITHUB_OUTPUT + - name: Upload zipped artifact + if: inputs.zip-artifact == 'true' + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.zip-artifact.outputs.filename }} + path: ${{ steps.zip-artifact.outputs.filepath }} + retention-days: 1 From 552fc1aad1142df38ec74508876b4ee3c2cb18f8 Mon Sep 17 00:00:00 2001 From: shiipou Date: Fri, 20 Jun 2025 09:02:51 +0200 Subject: [PATCH 02/16] feat: use unzip argument from my download-artifact PR --- .github/workflows/build-bun.yml | 65 +++++++++++++++----------- .github/workflows/build-docker.yml | 24 ++++++++-- .github/workflows/build-flutter.yml | 32 +++---------- .github/workflows/build-springboot.yml | 36 ++++---------- .github/workflows/coverage-report.yml | 17 +++++-- .github/workflows/deploy-flutter.yml | 21 ++++++++- .github/workflows/upsert-release.yml | 20 +++++++- README.md | 4 +- docs/build-docker.md | 2 +- docs/build-springboot.md | 2 +- docs/deploy-flutter.md | 4 +- docs/test-springboot.md | 2 +- 12 files changed, 133 insertions(+), 96 deletions(-) diff --git a/.github/workflows/build-bun.yml b/.github/workflows/build-bun.yml index 2c80a45..a1e2b80 100644 --- a/.github/workflows/build-bun.yml +++ b/.github/workflows/build-bun.yml @@ -16,18 +16,20 @@ on: default: 'latest' artifact-name: type: string - description: 'Give generated artifact a name' + description: 'Name of the artifact to upload, default: is basename of the artifact if single file, or dirname if multiple files, followed by the OS name' required: false artifact-path: type: string description: 'Path to the generated artifact to upload' required: false default: 'dist/' - zip-artifact: - type: boolean - description: 'Whether to produce a zip artifact alongside the build artifact' - required: false - default: false + outputs: + artifact-id: + description: 'The ID of the uploaded artifact' + value: ${{ steps.artifact-path.outputs.artifact-id }} + artifact-url: + description: 'The URL of the uploaded artifact' + value: ${{ steps.artifact-path.outputs.artifact-url }} jobs: build: @@ -54,30 +56,37 @@ jobs: - name: Install Bun dependencies run: bun install - - name: Build with Bun - run: bun run build + - id: build + name: Build with Bun + run: | + bun run build + if [ -n "${{ inputs.artifact-path }}" ]; then + echo -e "Artifact path is set to '${{ inputs.artifact-path }}.\nIncluding :" + ARTIFACT_CONTENT="$(ls -dAp "${{ inputs.artifact-path }}")" + echo "$ARTIFACT_CONTENT" + if [ -z "${{ inputs.artifact-name }}" ]; then + artifact_path="${{ inputs.artifact-path }}" + if [ -d "$artifact_path" ]; then + echo "Artifact path is a directory, using it as is." + artifact_path="$(dirname "$artifact_path")" + elif [ -f "$artifact_path" ]; then + echo "Artifact path is a file, using it as is." + artifact_path="$artifact_path" + elif [ "$(ls -A "$artifact_path")" ]; then + echo "Artifact is multiple files, using the directory." + artifact_path="$(dirname "$artifact_path")" + fi + ARTIFACT_NAME="${artifact_path}-${{ runner.os }}" + else + ARTIFACT_NAME="${{ inputs.artifact-name }}" + fi + echo "artifact-name=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT + fi - name: Upload build artifacts - if: inputs.artifact-name != '' && inputs.artifact-path != '' - uses: actions/upload-artifact@v4 + if: steps.build.outputs.artifact-name != '' + id: artifact-path + uses: actions/artifact-path@v4 with: name: ${{ inputs.artifact-name }} path: ${{ inputs.working-directory }}/${{ inputs.artifact-path }} - - id: zip-artifact - name: Zip artifact - if: inputs.zip-artifact == 'true' - run: | - filename="${{ inputs.artifact-name }}" - zipname="${filename}.zip" - tmp_file="$(mktemp -d)/${zipname}" - zip -r "${tmp_file}" ${filename} - echo "Zipped artifact created: ${tmp_file}" - echo "filename=${zipname}" >> $GITHUB_OUTPUT - echo "filepath=${tmp_file}" >> $GITHUB_OUTPUT - - name: Upload zipped artifact - if: inputs.zip-artifact == 'true' - uses: actions/upload-artifact@v4 - with: - name: ${{ steps.zip-artifact.outputs.filename }} - path: ${{ steps.zip-artifact.outputs.filepath }} - retention-days: 1 diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 2645c12..c20ac23 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -20,13 +20,27 @@ on: default: 'Dockerfile' with-artifact-name: type: string - description: 'Name of the artifact to include in the image' + description: 'Name of the artifact to include in the image, can''t be used with with-artifact-ids' required: false + with-artifact-ids: + type: string + description: 'Comma separated list of Ids of the artifact to include in the image, can''t be used with with-artifact-name' + required: false + with-artifact-unzip: + type: string + description: 'Comma separated list of ids or name of downloaded artifact that will be unzip. Default to all artifacts' + required: false + default: '*' with-artifact-path: type: string description: 'Where to place the artifacts' required: false default: 'artifacts/' + with-artifact-merge: + type: boolean + description: 'Whether to merge multiple artifacts into one folder' + required: false + default: false permissions: contents: read @@ -43,12 +57,14 @@ jobs: - uses: actions/checkout@v4 - name: Download artifact - if: inputs.with-artifact-name != '' - uses: actions/download-artifact@v4 + if: inputs.with-artifact-name != '' || inputs.with-artifact-ids != '' + uses: shiipou/download-artifact@main with: name: ${{ inputs.with-artifact-name }} + artifact-ids: ${{ inputs.with-artifact-ids }} path: ${{ inputs.working-directory }}/${{ inputs.with-artifact-path }} - + unzip: ${{ inputs.with-artifact-unzip }} + merge-multiple: ${{ inputs.with-artifact-merge }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/.github/workflows/build-flutter.yml b/.github/workflows/build-flutter.yml index 96ec6d8..0b81c9e 100644 --- a/.github/workflows/build-flutter.yml +++ b/.github/workflows/build-flutter.yml @@ -51,11 +51,6 @@ on: type: string description: 'Glob pattern for build artifacts' required: false - zip-artifact: - type: boolean - description: 'Whether to produce a zip artifact alongside the build artifact' - required: false - default: false secrets: UPLOAD_KEY_STORE: description: 'Keystore file content for Android signing' @@ -69,6 +64,13 @@ on: UPLOAD_STORE_PASSWORD: description: 'Password for the Android keystore' required: false + outputs: + artifact-id: + description: 'The ID of the uploaded artifact' + value: ${{ steps.upload-artifact.outputs.artifact-id }} + artifact-url: + description: 'The URL of the uploaded artifact' + value: ${{ steps.upload-artifact.outputs.artifact-url }} jobs: build: @@ -173,23 +175,3 @@ jobs: with: name: ${{ inputs.artifact-name }} path: ${{ inputs.working-directory }}/${{ inputs.artifact-path }} - - - id: zip-artifact - name: Zip artifact - if: inputs.zip-artifact == 'true' - run: | - filename="${{ inputs.artifact-name }}" - zipname="${filename}.zip" - tmp_file="$(mktemp -d)/${zipname}" - zip -r "${tmp_file}" ${filename} - echo "Zipped artifact created: ${tmp_file}" - echo "filename=${zipname}" >> $GITHUB_OUTPUT - echo "filepath=${tmp_file}" >> $GITHUB_OUTPUT - - name: Upload zipped artifact - if: inputs.zip-artifact == 'true' - uses: actions/upload-artifact@v4 - with: - name: ${{ steps.zip-artifact.outputs.filename }} - path: ${{ steps.zip-artifact.outputs.filepath }} - retention-days: 1 - \ No newline at end of file diff --git a/.github/workflows/build-springboot.yml b/.github/workflows/build-springboot.yml index 49037c0..bf916eb 100644 --- a/.github/workflows/build-springboot.yml +++ b/.github/workflows/build-springboot.yml @@ -28,11 +28,6 @@ on: description: 'Path to the generated artifact to upload' required: false default: 'build/libs/*.jar' - zip-artifact: - type: boolean - description: 'Whether to produce a zip artifact alongside the build artifact' - required: false - default: false envs: type: string description: 'Add extra env variable to the build, one value per line : =' @@ -41,14 +36,22 @@ on: envs: description: 'Add extra env variable to the build, one value per line : =' required: false - + outputs: + artifact-id: + description: 'The ID of the uploaded artifact' + value: ${{ jobs.build.outputs.artifact-id }} + artifact-url: + description: 'The URL of the uploaded artifact' + value: ${{ jobs.build.outputs.artifact-url }} jobs: build: runs-on: ubuntu-latest defaults: run: working-directory: ${{ inputs.working-directory }} - + outputs: + artifact-id: ${{ steps.upload-artifact.outputs.artifact-id }} + artifact-url: ${{ steps.upload-artifact.outputs.artifact-url }} steps: - uses: actions/checkout@v4 @@ -71,22 +74,3 @@ jobs: with: name: ${{ inputs.artifact-name }} path: ${{ inputs.working-directory }}/${{ inputs.artifact-path }} - - - id: zip-artifact - name: Zip artifact - if: inputs.zip-artifact == 'true' - run: | - filename="${{ inputs.artifact-name }}" - zipname="${filename}.zip" - tmp_file="$(mktemp -d)/${zipname}" - zip -r "${tmp_file}" ${filename} - echo "Zipped artifact created: ${tmp_file}" - echo "filename=${zipname}" >> $GITHUB_OUTPUT - echo "filepath=${tmp_file}" >> $GITHUB_OUTPUT - - name: Upload zipped artifact - if: inputs.zip-artifact == 'true' - uses: actions/upload-artifact@v4 - with: - name: ${{ steps.zip-artifact.outputs.filename }} - path: ${{ steps.zip-artifact.outputs.filepath }} - retention-days: 1 diff --git a/.github/workflows/coverage-report.yml b/.github/workflows/coverage-report.yml index c63bcd5..094487b 100644 --- a/.github/workflows/coverage-report.yml +++ b/.github/workflows/coverage-report.yml @@ -6,13 +6,22 @@ on: inputs: with-artifact-name: type: string - description: Coverage report artifact name + description: Coverage report artifact name, can't be used with with-artifact-ids + required: true + with-artifact-ids: + type: string + description: Coverage report artifact ids, can't be used with with-artifact-name required: true with-artifact-path: type: string description: Path to the coverage report artifact required: false default: lcov.info + with-artifact-merge: + type: boolean + description: Whether to merge multiple artifacts into one folder + required: false + default: false min-lines-coverage: type: number description: Minimum percentage of lines covered @@ -63,10 +72,12 @@ jobs: - name: Setup LCOV uses: hrishikesh-kadam/setup-lcov@v1 - name: Download coverage report - uses: actions/download-artifact@v4 + uses: shiipou/download-artifact@main with: - name: ${{ inputs.artifact-name }} + name: ${{ inputs.with-artifact-name }} + artifact-ids: ${{ inputs.with-artifact-ids }} path: coverage/ + merge-multiple: ${{ inputs.with-artifact-merge }} - name: Parse coverage report id: coverage run: | diff --git a/.github/workflows/deploy-flutter.yml b/.github/workflows/deploy-flutter.yml index cd699cf..7f7de60 100644 --- a/.github/workflows/deploy-flutter.yml +++ b/.github/workflows/deploy-flutter.yml @@ -10,12 +10,26 @@ on: required: true with-artifact-name: type: string - description: 'Identifier for the build artifact (e.g., android-aab or ios-ipa)' + description: 'Name for the build artifact to download (e.g., android-aab or ios-ipa), can''t be used with with-artifact-ids' required: true + with-artifact-ids: + type: string + description: 'Comma separated list of ids of the builds artifact to download, can''t be used with with-artifact-name' + required: true + with-artifact-unzip: + type: string + description: 'Comma separated list of ids or name of downloaded artifact that will be unzip. Default to all artifacts' + required: false + default: '*' with-artifact-path: type: string description: 'Path to the build file to deploy (inside of the artifact)' required: true + with-artifact-merge: + type: boolean + description: 'Whenever to download multiple artifacts into one same folder' + required: false + default: false package-name: type: string description: 'The package name of the app' @@ -46,10 +60,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/download-artifact@v4 + uses: shiipou/download-artifact@main with: name: ${{ inputs.with-artifact-name }} + artifact-ids: ${{ inputs.with-artifact-ids }} + unzip: ${{ inputs.with-artifact-unzip }} path: ./artifacts/ + merge-multiple: ${{ inputs.with-artifact-merge }} - name: Setup Flutter Environment uses: subosito/flutter-action@v2.18.0 with: diff --git a/.github/workflows/upsert-release.yml b/.github/workflows/upsert-release.yml index 58948bc..2807a23 100644 --- a/.github/workflows/upsert-release.yml +++ b/.github/workflows/upsert-release.yml @@ -19,12 +19,26 @@ on: default: false with-artifact-name: type: string - description: 'Identifier for the build artifact (e.g., android-aab or ios-ipa)' + description: 'Name for the build artifact to download (e.g., android-aab or ios-ipa), can''t be used with with-artifact-ids' required: false + with-artifact-ids: + type: string + description: 'Comma separated list of ids of the builds artifact to download, can''t be used with with-artifact-name' + required: false + with-artifact-unzip: + type: string + description: 'Comma separated list of ids or name of downloaded artifact that will be unzip. Default to all artifacts' + required: false + default: '*' with-artifact-path: type: string description: 'Comma separated list of file to deploy (inside of the artifact)' required: false + with-artifact-merge: + type: boolean + description: 'Whether to merge multiple artifacts into one folder' + required: false + default: false permissions: contents: write @@ -54,10 +68,12 @@ jobs: set -e - name: Download artifact - uses: actions/download-artifact@v4 + uses: shiipou/download-artifact@main with: name: ${{ inputs.with-artifact-name }} + artifact-ids: ${{ inputs.with-artifact-ids }} path: artifacts/ + unzip: ${{ inputs.with-artifact-unzip }} merge-multiple: true - name: Create release (if not exists) diff --git a/README.md b/README.md index cb235bc..e618dc9 100644 --- a/README.md +++ b/README.md @@ -82,8 +82,10 @@ Each workflow accepts specific inputs and secrets. See individual workflow files - `version`: Semantic version string - `artifact-name`: Name of the artifacts to produce - `artifact-path`: Path to files to upload as artifact -- `with-artifact-name`: Name of the artifacts to use +- `with-artifact-name`: Name of the artifacts to use, can't be used with `with-artifact-ids` +- `with-artifact-ids`: Comma separated list of Ids of the artifacts to use, can't be used with `with-artifact-name` - `with-artifact-path`: Path to files in artifact +- `with-artifact-unzip`: Which artifact to unzip during download. Comma separated list of names, Ids, true, false, or '*'. ## 📚 Examples diff --git a/docs/build-docker.md b/docs/build-docker.md index 0c453a7..041aa85 100644 --- a/docs/build-docker.md +++ b/docs/build-docker.md @@ -22,6 +22,6 @@ build-docker: working-directory: server tags: ${{ needs.generate-version-names.outputs.tags }} dockerfile: ci.Dockerfile - with-artifact-name: server + with-artifact-ids: ${{ needs.build.outputs.artifact-id }} with-artifact-path: build/libs/ ``` diff --git a/docs/build-springboot.md b/docs/build-springboot.md index 1b62fb7..9344a52 100644 --- a/docs/build-springboot.md +++ b/docs/build-springboot.md @@ -13,7 +13,7 @@ on: jobs: build: name: Build Spring Boot App - uses: shiipou/github-actions/.github/workflows/build-springboot.yml@main + uses: lenra-io/github-actions/.github/workflows/build-springboot.yml@main with: working-directory: server artifact-name: server diff --git a/docs/deploy-flutter.md b/docs/deploy-flutter.md index 2dd851c..9346b5d 100644 --- a/docs/deploy-flutter.md +++ b/docs/deploy-flutter.md @@ -5,7 +5,7 @@ It can deploy to multiple store : ```yml -deploy-playstore: + deploy-playstore: name: Deploy to PlayStore uses: lenra-io/github-actions/.github/workflows/deploy-flutter.yml@main with: @@ -27,6 +27,6 @@ deploy-playstore: secrets: appstore-username: ${{ secrets.appstore_username }} appstore-password: ${{ secrets.appstore_password }} - appstoore-apikey: ${{ secrets.appstore_apikey }} + appstore-apikey: ${{ secrets.appstore_apikey }} appstore-apiissuer: ${{ secrets.appstore_apiissuer }} ``` diff --git a/docs/test-springboot.md b/docs/test-springboot.md index e335239..3bd144d 100644 --- a/docs/test-springboot.md +++ b/docs/test-springboot.md @@ -13,7 +13,7 @@ on: jobs: test: name: Test Spring Boot App - uses: shiipou/github-actions/.github/workflows/test-springboot.yml@main + uses: lenra-io/github-actions/.github/workflows/test-springboot.yml@main with: artifact-name: coverage-report ``` From aa90c7122014b7a87e53c51f38ca62a5342f8ec5 Mon Sep 17 00:00:00 2001 From: shiipou Date: Fri, 20 Jun 2025 09:18:00 +0200 Subject: [PATCH 03/16] fix: add outputs --- .github/workflows/build-bun.yml | 10 ++++++---- .github/workflows/build-flutter.yml | 7 +++++-- .github/workflows/test-bun.yml | 11 ++++++++++- .github/workflows/test-flutter.yml | 10 ++++++++++ .github/workflows/test-springboot.yml | 10 ++++++++++ 5 files changed, 41 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-bun.yml b/.github/workflows/build-bun.yml index a1e2b80..c270def 100644 --- a/.github/workflows/build-bun.yml +++ b/.github/workflows/build-bun.yml @@ -26,10 +26,10 @@ on: outputs: artifact-id: description: 'The ID of the uploaded artifact' - value: ${{ steps.artifact-path.outputs.artifact-id }} + value: ${{ jobs.build.outputs.artifact-id }} artifact-url: description: 'The URL of the uploaded artifact' - value: ${{ steps.artifact-path.outputs.artifact-url }} + value: ${{ jobs.build.outputs.artifact-url }} jobs: build: @@ -37,7 +37,9 @@ jobs: defaults: run: working-directory: ${{ inputs.working-directory }} - + outputs: + artifact-id: ${{ steps.artifact-path.outputs.artifact-id }} + artifact-url: ${{ steps.artifact-path.outputs.artifact-url }} steps: - uses: actions/checkout@v4 @@ -84,7 +86,7 @@ jobs: fi - name: Upload build artifacts - if: steps.build.outputs.artifact-name != '' + if: steps.build.outputs.artifact-name != '' && inputs.artifact-path != '' id: artifact-path uses: actions/artifact-path@v4 with: diff --git a/.github/workflows/build-flutter.yml b/.github/workflows/build-flutter.yml index 0b81c9e..fe50385 100644 --- a/.github/workflows/build-flutter.yml +++ b/.github/workflows/build-flutter.yml @@ -67,10 +67,10 @@ on: outputs: artifact-id: description: 'The ID of the uploaded artifact' - value: ${{ steps.upload-artifact.outputs.artifact-id }} + value: ${{ jobs.build.outputs.artifact-id }} artifact-url: description: 'The URL of the uploaded artifact' - value: ${{ steps.upload-artifact.outputs.artifact-url }} + value: ${{ jobs.build.outputs.artifact-url }} jobs: build: @@ -78,6 +78,9 @@ jobs: run: working-directory: ${{ inputs.working-directory }} runs-on: ${{ inputs.runner }} + outputs: + artifact-id: ${{ steps.upload-artifact.outputs.artifact-id }} + artifact-url: ${{ steps.upload-artifact.outputs.artifact-url }} steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/test-bun.yml b/.github/workflows/test-bun.yml index 26eea54..b98c335 100644 --- a/.github/workflows/test-bun.yml +++ b/.github/workflows/test-bun.yml @@ -14,6 +14,13 @@ on: description: 'Version of Java to use' required: false default: 'latest' + outputs: + artifact-id: + description: 'The ID of the uploaded artifact' + value: ${{ jobs.build.outputs.artifact-id }} + artifact-url: + description: 'The URL of the uploaded artifact' + value: ${{ jobs.build.outputs.artifact-url }} jobs: build: @@ -21,7 +28,9 @@ jobs: defaults: run: working-directory: ${{ inputs.working-directory }} - + outputs: + artifact-id: ${{ steps.upload-artifact.outputs.artifact-id }} + artifact-url: ${{ steps.upload-artifact.outputs.artifact-url }} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/test-flutter.yml b/.github/workflows/test-flutter.yml index bc4f004..5840fc8 100644 --- a/.github/workflows/test-flutter.yml +++ b/.github/workflows/test-flutter.yml @@ -27,6 +27,13 @@ on: description: 'Coverage report path to upload as artifact' required: false default: 'coverage/lcov.info' + outputs: + artifact-id: + description: 'The ID of the uploaded artifact' + value: ${{ jobs.test.outputs.artifact-id }} + artifact-url: + description: 'The URL of the uploaded artifact' + value: ${{ jobs.test.outputs.artifact-url }} jobs: test: @@ -34,6 +41,9 @@ jobs: defaults: run: working-directory: ${{ inputs.working-directory }} + outputs: + artifact-id: ${{ steps.upload-artifact.outputs.artifact-id }} + artifact-url: ${{ steps.upload-artifact.outputs.artifact-url }} steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/test-springboot.yml b/.github/workflows/test-springboot.yml index d9439d6..8f0b646 100644 --- a/.github/workflows/test-springboot.yml +++ b/.github/workflows/test-springboot.yml @@ -28,6 +28,13 @@ on: description: 'Path to the generated artifact to upload' required: false default: 'build/reports/tests/test/' + outputs: + artifact-id: + description: 'The ID of the uploaded artifact' + value: ${{ jobs.test.outputs.artifact-id }} + artifact-url: + description: 'The URL of the uploaded artifact' + value: ${{ jobs.test.outputs.artifact-url }} jobs: test: @@ -35,6 +42,9 @@ jobs: defaults: run: working-directory: ${{ inputs.working-directory }} + outputs: + artifact-id: ${{ steps.upload-artifact.outputs.artifact-id }} + artifact-url: ${{ steps.upload-artifact.outputs.artifact-url }} services: postgres: image: postgres From ef29ba36c6c89f62c4063e04d113cdfc666ecc20 Mon Sep 17 00:00:00 2001 From: shiipou Date: Fri, 20 Jun 2025 14:13:57 +0200 Subject: [PATCH 04/16] fix: required arguments is now not required --- .github/workflows/coverage-report.yml | 4 ++-- .github/workflows/deploy-flutter.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/coverage-report.yml b/.github/workflows/coverage-report.yml index 094487b..c895d89 100644 --- a/.github/workflows/coverage-report.yml +++ b/.github/workflows/coverage-report.yml @@ -7,11 +7,11 @@ on: with-artifact-name: type: string description: Coverage report artifact name, can't be used with with-artifact-ids - required: true + required: false with-artifact-ids: type: string description: Coverage report artifact ids, can't be used with with-artifact-name - required: true + required: false with-artifact-path: type: string description: Path to the coverage report artifact diff --git a/.github/workflows/deploy-flutter.yml b/.github/workflows/deploy-flutter.yml index 7f7de60..2d6d40f 100644 --- a/.github/workflows/deploy-flutter.yml +++ b/.github/workflows/deploy-flutter.yml @@ -11,11 +11,11 @@ on: with-artifact-name: type: string description: 'Name for the build artifact to download (e.g., android-aab or ios-ipa), can''t be used with with-artifact-ids' - required: true + required: false with-artifact-ids: type: string description: 'Comma separated list of ids of the builds artifact to download, can''t be used with with-artifact-name' - required: true + required: false with-artifact-unzip: type: string description: 'Comma separated list of ids or name of downloaded artifact that will be unzip. Default to all artifacts' From 5606f72e9780f06f72fe4ce6ff5cbf410efa26bf Mon Sep 17 00:00:00 2001 From: shiipou Date: Fri, 20 Jun 2025 14:21:21 +0200 Subject: [PATCH 05/16] fix: artifact-path incorrect arg --- .github/workflows/build-bun.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-bun.yml b/.github/workflows/build-bun.yml index c270def..bebc056 100644 --- a/.github/workflows/build-bun.yml +++ b/.github/workflows/build-bun.yml @@ -38,8 +38,8 @@ jobs: run: working-directory: ${{ inputs.working-directory }} outputs: - artifact-id: ${{ steps.artifact-path.outputs.artifact-id }} - artifact-url: ${{ steps.artifact-path.outputs.artifact-url }} + artifact-id: ${{ steps.upload-artifact.outputs.artifact-id }} + artifact-url: ${{ steps.upload-artifact.outputs.artifact-url }} steps: - uses: actions/checkout@v4 @@ -87,8 +87,8 @@ jobs: - name: Upload build artifacts if: steps.build.outputs.artifact-name != '' && inputs.artifact-path != '' - id: artifact-path - uses: actions/artifact-path@v4 + id: upload-artifact + uses: actions/upload-artifact@v4 with: name: ${{ inputs.artifact-name }} path: ${{ inputs.working-directory }}/${{ inputs.artifact-path }} From 373d8360e006afdd66dd134b0d75b4b036bb965a Mon Sep 17 00:00:00 2001 From: shiipou Date: Fri, 20 Jun 2025 14:39:54 +0200 Subject: [PATCH 06/16] fix: with-artifact-path --- .github/workflows/upsert-release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/upsert-release.yml b/.github/workflows/upsert-release.yml index 2807a23..c3ef621 100644 --- a/.github/workflows/upsert-release.yml +++ b/.github/workflows/upsert-release.yml @@ -80,8 +80,9 @@ jobs: if: steps.check_release.outputs.exists == 'false' run: | artifact_arg='' - if [ -n "${{ inputs.artifact-path }}" ]; then - artifact_arg="artifacts/${{ inputs.with-artifact-path }}" + if [ -n "${{ inputs.with-artifact-path }}" ]; then + IFS=',' read -r -a artifacts <<< "${{ inputs.with-artifact-path }}" + artifacts_arg="artifacts/${artifacts[@]}" fi prerelease_args='' From 7558003b2c75a3e696d18c7bc8bab9752fa59808 Mon Sep 17 00:00:00 2001 From: shiipou Date: Fri, 20 Jun 2025 14:58:56 +0200 Subject: [PATCH 07/16] fix: echo artifacts with LS --- .github/workflows/upsert-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/upsert-release.yml b/.github/workflows/upsert-release.yml index c3ef621..be217cb 100644 --- a/.github/workflows/upsert-release.yml +++ b/.github/workflows/upsert-release.yml @@ -83,6 +83,7 @@ jobs: if [ -n "${{ inputs.with-artifact-path }}" ]; then IFS=',' read -r -a artifacts <<< "${{ inputs.with-artifact-path }}" artifacts_arg="artifacts/${artifacts[@]}" + echo "Artifacts to upload: $(ls -pAR artifacts/${artifacts})" fi prerelease_args='' From a21d4d77b0bb78e5f946dd9e08e8fa0e14ca434a Mon Sep 17 00:00:00 2001 From: shiipou Date: Fri, 20 Jun 2025 18:01:13 +0200 Subject: [PATCH 08/16] fix: upload artifact separatly --- .github/workflows/upsert-release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/upsert-release.yml b/.github/workflows/upsert-release.yml index be217cb..e558c4d 100644 --- a/.github/workflows/upsert-release.yml +++ b/.github/workflows/upsert-release.yml @@ -96,8 +96,9 @@ jobs: --repo ${{ github.repository }} \ -t "v${{ inputs.version }}" \ $prerelease_args \ - -F <(echo "${{ inputs.changelog }}") \ - $artifact_arg + -F <(echo "${{ inputs.changelog }}") + + gh release upload "v${{ inputs.version }}" $artifacts_arg --clobber --repo ${{ github.repository }} - name: Update release (if already exists) if: steps.check_release.outputs.exists == 'true' From 92d88657a06589d4233af2be539bffa8e816cabe Mon Sep 17 00:00:00 2001 From: shiipou Date: Sat, 21 Jun 2025 10:30:48 +0200 Subject: [PATCH 09/16] fix: upload artifact only if this is asked by inputs --- .github/workflows/upsert-release.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/upsert-release.yml b/.github/workflows/upsert-release.yml index e558c4d..7129bce 100644 --- a/.github/workflows/upsert-release.yml +++ b/.github/workflows/upsert-release.yml @@ -79,11 +79,7 @@ jobs: - name: Create release (if not exists) if: steps.check_release.outputs.exists == 'false' run: | - artifact_arg='' if [ -n "${{ inputs.with-artifact-path }}" ]; then - IFS=',' read -r -a artifacts <<< "${{ inputs.with-artifact-path }}" - artifacts_arg="artifacts/${artifacts[@]}" - echo "Artifacts to upload: $(ls -pAR artifacts/${artifacts})" fi prerelease_args='' @@ -98,7 +94,16 @@ jobs: $prerelease_args \ -F <(echo "${{ inputs.changelog }}") - gh release upload "v${{ inputs.version }}" $artifacts_arg --clobber --repo ${{ github.repository }} + if [ -n "${{ inputs.with-artifact-path }}" ]; then + IFS=',' read -r -a artifacts <<< "${{ inputs.with-artifact-path }}" + artifacts_arg="" + echo "Artifacts to upload:" + for artifact in "${artifacts[@]}"; do + artifacts_arg+="artifacts/${artifact} " + ls -pAR artifacts/${artifacts} + done + gh release upload "v${{ inputs.version }}" $artifacts_arg --clobber --repo ${{ github.repository }} + fi - name: Update release (if already exists) if: steps.check_release.outputs.exists == 'true' @@ -106,7 +111,12 @@ jobs: echo "Release ${{ inputs.version }} already exists; updating assets..." if [ -n "${{ inputs.with-artifact-path }}" ]; then IFS=',' read -r -a artifacts <<< "${{ inputs.with-artifact-path }}" - artifacts_arg="artifacts/${artifacts[@]}" + artifacts_arg="" + echo "Artifacts to upload:" + for artifact in "${artifacts[@]}"; do + artifacts_arg="artifacts/${artifacts[@]}" + ls -pAR artifacts/${artifacts} + done gh release upload "v${{ inputs.version }}" $artifacts_arg --clobber --repo ${{ github.repository }} else echo "No artifact to upload" From ee33e3d2bf8b9638a8542a81d16743ef5011903a Mon Sep 17 00:00:00 2001 From: Shiipou Date: Tue, 1 Jul 2025 11:09:49 +0200 Subject: [PATCH 10/16] fix: remove useless `if` --- .github/workflows/upsert-release.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/upsert-release.yml b/.github/workflows/upsert-release.yml index 7129bce..c02604d 100644 --- a/.github/workflows/upsert-release.yml +++ b/.github/workflows/upsert-release.yml @@ -79,9 +79,6 @@ jobs: - name: Create release (if not exists) if: steps.check_release.outputs.exists == 'false' run: | - if [ -n "${{ inputs.with-artifact-path }}" ]; then - fi - prerelease_args='' if ${{ inputs.prerelease }} ; then prerelease_args='--prerelease' From 9852a773ebb7e11e4214ebbbaeaf8909ed43e79b Mon Sep 17 00:00:00 2001 From: Shiipou Date: Tue, 1 Jul 2025 11:42:41 +0200 Subject: [PATCH 11/16] ci: fix missing upload-artifact id for job --- .github/workflows/build-springboot.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-springboot.yml b/.github/workflows/build-springboot.yml index bf916eb..d4f601e 100644 --- a/.github/workflows/build-springboot.yml +++ b/.github/workflows/build-springboot.yml @@ -68,7 +68,8 @@ jobs: - name: Build with Gradle run: gradle build -x test - - name: Upload build artifacts + - id: upload-artifact + name: Upload build artifacts if: inputs.artifact-name != '' && inputs.artifact-path != '' uses: actions/upload-artifact@v4 with: From 3dd48c4ed7bbecce25b3f548b97a95a0417e79a1 Mon Sep 17 00:00:00 2001 From: Thomas DA ROCHA Date: Wed, 2 Jul 2025 10:32:41 +0200 Subject: [PATCH 12/16] fix: generate-version-names for prerelease --- .github/workflows/generate-version-names.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate-version-names.yml b/.github/workflows/generate-version-names.yml index 273e42a..71105a7 100644 --- a/.github/workflows/generate-version-names.yml +++ b/.github/workflows/generate-version-names.yml @@ -40,8 +40,8 @@ jobs: tags="$tags,${template//\[:version:\]/$major_minor},${template//\[:version:\]/$major}" else # For prerelease, generate only the major.minor-prerelease tag - major_minor_prerelease=$(echo "$version" | grep -oE '^[0-9]+\.[0-9]+-[^\.]+') - if [[ -n "$major_minor_prerelease" ]]; then + major_minor_prerelease=$(echo "$version" | sed -E 's/^([0-9]+)\.([0-9]+).([0-9]+)-(.+)$/\1.\2-\4/') + if [[ "$major_minor_prerelease" != "$version" ]]; then tags="$tags,${template//\[:version:\]/$major_minor_prerelease}" fi fi From 5ae1da58afa57f24cfc98ae9580201738ce193e3 Mon Sep 17 00:00:00 2001 From: Shiipou Date: Fri, 8 Aug 2025 17:09:44 +0200 Subject: [PATCH 13/16] fix: use of with-artifact-path --- .github/workflows/coverage-report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage-report.yml b/.github/workflows/coverage-report.yml index c895d89..b380f97 100644 --- a/.github/workflows/coverage-report.yml +++ b/.github/workflows/coverage-report.yml @@ -88,7 +88,7 @@ jobs: echo "${BASH_REMATCH[1]}-total=${BASH_REMATCH[4]}" >> $GITHUB_OUTPUT echo "${BASH_REMATCH[1]}-percentage=${BASH_REMATCH[2]}" >> $GITHUB_OUTPUT fi - done < <(lcov --summary coverage/${{ inputs.artifact-path }}) + done < <(lcov --summary coverage/${{ inputs.with-artifact-path }}) - name: Check coverage report data if: inputs.min-lines-coverage != '' run: | From 5762997874cb99155e67962f9d920188177b6808 Mon Sep 17 00:00:00 2001 From: Shiipou Date: Wed, 27 Aug 2025 17:49:49 +0200 Subject: [PATCH 14/16] fix: Remove useless envs --- .github/workflows/test-springboot.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/test-springboot.yml b/.github/workflows/test-springboot.yml index 5443794..1f9dda5 100644 --- a/.github/workflows/test-springboot.yml +++ b/.github/workflows/test-springboot.yml @@ -71,10 +71,6 @@ jobs: docker compose up -f ${{ inputs.compose-file }} --profile ${{ $inputs.compose-profile }} -d - name: Build with Gradle - env: - DATABASE_URL: postgresql://localhost:5432/reveel - DATABASE_USER: reveel - DATABASE_PASSWORD: reveel-app run: gradle test - name: Upload build artifacts From f346594bef8d314b043a64e26b3be62750fdf2fc Mon Sep 17 00:00:00 2001 From: Shiipou Date: Wed, 27 Aug 2025 17:51:40 +0200 Subject: [PATCH 15/16] fix: remove useless `#` on ${{ inputs }} --- .github/workflows/test-springboot.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-springboot.yml b/.github/workflows/test-springboot.yml index 1f9dda5..95f02d8 100644 --- a/.github/workflows/test-springboot.yml +++ b/.github/workflows/test-springboot.yml @@ -68,7 +68,7 @@ jobs: - name: Run compose-file if: inputs.compose-file != '' run: | - docker compose up -f ${{ inputs.compose-file }} --profile ${{ $inputs.compose-profile }} -d + docker compose up -f ${{ inputs.compose-file }} --profile ${{ inputs.compose-profile }} -d - name: Build with Gradle run: gradle test @@ -82,4 +82,4 @@ jobs: - name: Stop compose-file if: inputs.compose-file != '' && always() - run: docker compose down -f ${{ inputs.compose-file }} --profile ${{ $inputs.compose-profile }} + run: docker compose down -f ${{ inputs.compose-file }} --profile ${{ inputs.compose-profile }} From d89c9b275e179641a8506a6f4ecefa38f63df747 Mon Sep 17 00:00:00 2001 From: Shiipou Date: Wed, 27 Aug 2025 17:53:11 +0200 Subject: [PATCH 16/16] fix: move args before `up` in compose --- .github/workflows/test-springboot.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-springboot.yml b/.github/workflows/test-springboot.yml index 95f02d8..e03b375 100644 --- a/.github/workflows/test-springboot.yml +++ b/.github/workflows/test-springboot.yml @@ -68,7 +68,7 @@ jobs: - name: Run compose-file if: inputs.compose-file != '' run: | - docker compose up -f ${{ inputs.compose-file }} --profile ${{ inputs.compose-profile }} -d + docker compose -f ${{ inputs.compose-file }} --profile ${{ inputs.compose-profile }} up -d - name: Build with Gradle run: gradle test @@ -82,4 +82,4 @@ jobs: - name: Stop compose-file if: inputs.compose-file != '' && always() - run: docker compose down -f ${{ inputs.compose-file }} --profile ${{ inputs.compose-profile }} + run: docker compose -f ${{ inputs.compose-file }} --profile ${{ inputs.compose-profile }} down