From 35a0d8556a728f5cdb0b371130ff15e25b7d3653 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sun, 31 Mar 2024 21:32:46 +0200 Subject: [PATCH] fix: ci release Signed-off-by: Emilien Escalle --- .github/workflows/release-actions.yml | 16 +++- .../.github/workflows/release-actions.md | 77 ------------------- 2 files changed, 12 insertions(+), 81 deletions(-) delete mode 100644 ci-github-common/.github/workflows/release-actions.md diff --git a/.github/workflows/release-actions.yml b/.github/workflows/release-actions.yml index 1549acd..4fd59ce 100644 --- a/.github/workflows/release-actions.yml +++ b/.github/workflows/release-actions.yml @@ -148,13 +148,17 @@ jobs: with: value: ${{ matrix.action }} - - run: | + - id: prepare-readme-generator + run: | jq '.paths.action = "${{ matrix.action }}/action.yml"' .ghadocs.json > .ghadocs.json.tmp mv .ghadocs.json.tmp .ghadocs.json jq '.paths.readme = "${{ matrix.action }}/README.md"' .ghadocs.json > .ghadocs.json.tmp mv .ghadocs.json.tmp .ghadocs.json + WORKSPACE_PATH=$(echo "${{ github.workspace }}" | sed 's/\/\([^/]\+\)/*\1/') + echo "readme-file=${WORKSPACE_PATH}/${{ matrix.action }}/README.md" >> "$GITHUB_OUTPUT" + - name: 📖 Generate README uses: bitflight-devops/github-action-readme-generator@v1.8.0 with: @@ -173,7 +177,7 @@ jobs: - uses: actions/upload-artifact@v4 with: name: changed-files-${{ steps.action-slug.outputs.result }} - path: ${{ github.workspace }}*/${{ matrix.action }}/README.md + path: ${{ steps.prepare-readme-generator.outputs.readme-file }} generate-workflows-readme: needs: prepare-release @@ -213,7 +217,10 @@ jobs: WORKFLOW_FILE="${{ matrix.workflow }}" README_FILE="${WORKFLOW_FILE%.*}.md" - echo "readme-file=${README_FILE}" >> "$GITHUB_OUTPUT" + WORKSPACE_PATH=$(echo "${{ github.workspace }}" | sed 's/\/\([^/]\+\)/*\1/') + echo "readme-file=${WORKSPACE_PATH}/${README_FILE}" >> "$GITHUB_OUTPUT" + + `${{ github.workspace }}`.replace(/\/([^/]+)/, '/*$1'); WORKFLOW_FULL_PATH="${{ github.repository }}/${WORKFLOW_FILE}" @@ -222,7 +229,7 @@ jobs: - uses: actions/upload-artifact@v4 with: name: changed-files-${{ steps.workflow-slug.outputs.result }} - path: ${{ github.workspace }}*/${{ steps.generate-readme.outputs.readme-file }} + path: ${{ steps.generate-readme.outputs.readme-file }} publish-actions-readme: needs: [prepare-release, generate-actions-readme, generate-workflows-readme] @@ -241,6 +248,7 @@ jobs: with: pattern: changed-files-* merge-multiple: true + path: / - uses: actions/create-github-app-token@v1 if: inputs.github-app-id diff --git a/ci-github-common/.github/workflows/release-actions.md b/ci-github-common/.github/workflows/release-actions.md deleted file mode 100644 index b5acef2..0000000 --- a/ci-github-common/.github/workflows/release-actions.md +++ /dev/null @@ -1,77 +0,0 @@ - - - - -# GitHub Reusable Workflow: Release Actions - - - - - - -Reusable workflow that performs actions and workflows release. - -- Generates README for changed actions and workflows (documentation, versioning, etc.) -- Commits and pushes the changes to the main branch - - - - - - -```yaml -name: "Release Actions" - -on: - push: - branches: [main] - tags: ["*"] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - release: - uses: hoverkraft-tech/ci-github-common/.github/workflows/release-actions.yml@0.12.1 - with: - # Update all actions and workflows, regardless of changes. - update-all: false - - # GitHub App ID to generate GitHub token in place of private-access-token. - # See https://github.com/actions/create-github-app-token - github-app-id: "" - - secrets: - # GitHub token for creating and merging pull request (permissions contents: write and pull-requests: write, workflows: write). - # See [actions/create-and-merge-pull-request](../../actions/create-and-merge-pull-request) - github-token: "" - - # GitHub App private key to generate GitHub token in place of github-token. - # See https://github.com/actions/create-github-app-token - github-app-key: "" -``` - - - - -| **Secret** | **Description** | **Default** | **Required** | -| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- | ------------ | -| **github-token** | GitHub token for creating and merging pull request (permissions contents: write and pull-requests: write, workflows: write). See [../../actions/create-and-merge-pull-request](../../actions/create-and-merge-pull-request) | GITHUB_TOKEN | **false** | -| **github-app-key** | GitHub App private key to generate GitHub token in place of github-token. See [https://github.com/actions/create-github-app-token](https://github.com/actions/create-github-app-token) | | **false** | - - - - -| **Input** | **Description** | **Default** | **Required** | -| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ------------ | -| **runs-on** | Json array of runner(s) to use. See [https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job](https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job) | ["ubuntu-latest"] | **false** | -| **update-all** | Update all actions and workflows, regardless of changes. | false | **false** | -| **github-app-id** | GitHub App ID to generate GitHub token in place of private-access-token. See [https://github.com/actions/create-github-app-token](https://github.com/actions/create-github-app-token) | | **false** | - - - - - - -