From c1d78490467a9a9538a44feb06cc016e6d2df135 Mon Sep 17 00:00:00 2001 From: Eduardo Gonzalez Date: Thu, 11 Sep 2025 17:47:11 +0200 Subject: [PATCH] workflows: Add release in main action Add the release in the main action. The release will only be trigger on tags push, only people with high privileges can push tags, so no security problem. Having it in a separate action file does not work because the workflow_run can not know if was a tag push or a pull request. Having it together with the main build action improves maintainability because we do not have to repeat the build step. Signed-off-by: Eduardo Gonzalez --- .github/workflows/conf-build-test.yml | 68 +++++++++++++++++++++++++-- .github/workflows/release-deploy.yml | 60 ----------------------- 2 files changed, 63 insertions(+), 65 deletions(-) delete mode 100644 .github/workflows/release-deploy.yml diff --git a/.github/workflows/conf-build-test.yml b/.github/workflows/conf-build-test.yml index 50b5f49..4661ece 100644 --- a/.github/workflows/conf-build-test.yml +++ b/.github/workflows/conf-build-test.yml @@ -4,7 +4,7 @@ run-name: ${{ github.actor }} ${{ github.event_name }} to ${{ github.event.pull_ on: push: tags: - - 'v*' + - "v*" pull_request: branches: [main, develop] @@ -63,14 +63,72 @@ jobs: echo "${{ github.event.pull_request.head.repo.full_name }}" > ${{ runner.temp }}/common/pr-head-repo echo "${{ github.event.pull_request.head.sha }}" > ${{ runner.temp }}/common/pr-head-sha - - uses: actions/upload-artifact@v4 + - name: Upload linux artifact + uses: actions/upload-artifact@v4 with: name: linux path: build/default-develop/packages-default-develop/* - - uses: actions/upload-artifact@v4 + - name: Upload common artifact + uses: actions/upload-artifact@v4 with: name: common - path: | - ${{ runner.temp }}/common/* + path: ${{ runner.temp }}/common/* + release-deploy: + if: ${{ startsWith(github.ref, 'refs/tags/v') }} + needs: [build_test_package] + runs-on: ubuntu-latest + permissions: + contents: write + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + + - name: Move docs to website dir + run: mv artifacts/common/html github-pages + + - name: Clean packages + run: | + rm -rf artifacts/*/_CPack_Packages + mv artifacts/common . || true + + - name: Create CHANGELOG + run: | + git log $(git rev-list --tags --skip=1 --max-count=1 | xargs git describe --tags --abbrev=0)..$(git describe --tags --abbrev=0) \ + --pretty=format:"* %h - %s (%an, %ar)" > CHANGELOG.md + + - name: Package GitHub Page content + working-directory: ${{ github.workspace }}/github-pages + run: | + cmake -E make_directory ${{ runner.temp }}/page-packages + cmake -E tar c ${{ runner.temp }}/page-packages/github-pages.tar -- . + + - name: Release + uses: softprops/action-gh-release@v2 + with: + files: ./artifacts/*/* + body_path: ./CHANGELOG.md + + - name: Upload github-pages artifact + uses: actions/upload-artifact@v4 + with: + name: github-pages + path: ${{ runner.temp }}/page-packages/* + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/release-deploy.yml b/.github/workflows/release-deploy.yml deleted file mode 100644 index 5503c30..0000000 --- a/.github/workflows/release-deploy.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: release-deploy - -on: - workflow_run: - workflows: ["push-build-test-lint-release"] - types: - - completed - -jobs: - release: - if: ${{ github.event.workflow_run.conclusion == 'success' && startsWith(github.ref, 'refs/tags/v') }} - runs-on: ubuntu-latest - permissions: - contents: write - pages: write - id-token: write - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: actions/download-artifact@v4 - with: - path: artifacts - - - name: Move docs to website dir - run: mv artifacts/common/html github-pages - - - name: Clean packages - run: | - rm -rf artifacts/*/_CPack_Packages - mv artifacts/common . || true - - - name: Create CHANGELOG - run: | - git log $(git rev-list --tags --skip=1 --max-count=1 | xargs git describe --tags --abbrev=0)..$(git describe --tags --abbrev=0) \ - --pretty=format:"* %h - %s (%an, %ar)" > CHANGELOG.md - - - name: Package GitHub Page content - working-directory: ${{ github.workspace }}/github-pages - run: | - cmake -E make_directory ${{ runner.temp }}/page-packages - cmake -E tar c ${{ runner.temp }}/page-packages/github-pages.tar -- . - - - name: Release - uses: softprops/action-gh-release@v2 - with: - files: ./artifacts/*/* - body_path: ./CHANGELOG.md - - - uses: actions/upload-artifact@v4 - with: - name: github-pages - path: ${{ runner.temp }}/page-packages/* - - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 -