Skip to content

Commit f57012f

Browse files
committed
workflows: Add release in main action
Add the release action in the main action. The release will only be trigger on tags push only people with administrative privileges can push tags, so no security problem. Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
1 parent 5831c7e commit f57012f

File tree

2 files changed

+63
-65
lines changed

2 files changed

+63
-65
lines changed

.github/workflows/conf-build-test.yml

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ run-name: ${{ github.actor }} ${{ github.event_name }} to ${{ github.event.pull_
44
on:
55
push:
66
tags:
7-
- 'v*'
7+
- "v*"
88
pull_request:
99
branches: [main, develop]
1010

@@ -63,14 +63,72 @@ jobs:
6363
echo "${{ github.event.pull_request.head.repo.full_name }}" > ${{ runner.temp }}/common/pr-head-repo
6464
echo "${{ github.event.pull_request.head.sha }}" > ${{ runner.temp }}/common/pr-head-sha
6565
66-
- uses: actions/upload-artifact@v4
66+
- name: Upload linux artifact
67+
uses: actions/upload-artifact@v4
6768
with:
6869
name: linux
6970
path: build/default-develop/packages-default-develop/*
7071

71-
- uses: actions/upload-artifact@v4
72+
- name: Upload common artifact
73+
uses: actions/upload-artifact@v4
7274
with:
7375
name: common
74-
path: |
75-
${{ runner.temp }}/common/*
76+
path: ${{ runner.temp }}/common/*
7677

78+
release-deploy:
79+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
80+
needs: [build_test_package]
81+
runs-on: ubuntu-latest
82+
permissions:
83+
contents: write
84+
pages: write
85+
id-token: write
86+
environment:
87+
name: github-pages
88+
url: ${{ steps.deployment.outputs.page_url }}
89+
90+
steps:
91+
- name: Checkout
92+
uses: actions/checkout@v4
93+
with:
94+
fetch-depth: 0
95+
96+
- name: Download artifacts
97+
uses: actions/download-artifact@v4
98+
with:
99+
path: artifacts
100+
101+
- name: Move docs to website dir
102+
run: mv artifacts/common/html github-pages
103+
104+
- name: Clean packages
105+
run: |
106+
rm -rf artifacts/*/_CPack_Packages
107+
mv artifacts/common . || true
108+
109+
- name: Create CHANGELOG
110+
run: |
111+
git log $(git rev-list --tags --skip=1 --max-count=1 | xargs git describe --tags --abbrev=0)..$(git describe --tags --abbrev=0) \
112+
--pretty=format:"* %h - %s (%an, %ar)" > CHANGELOG.md
113+
114+
- name: Package GitHub Page content
115+
working-directory: ${{ github.workspace }}/github-pages
116+
run: |
117+
cmake -E make_directory ${{ runner.temp }}/page-packages
118+
cmake -E tar c ${{ runner.temp }}/page-packages/github-pages.tar -- .
119+
120+
- name: Release
121+
uses: softprops/action-gh-release@v2
122+
with:
123+
files: ./artifacts/*/*
124+
body_path: ./CHANGELOG.md
125+
126+
- name: Upload github-pages artifact
127+
uses: actions/upload-artifact@v4
128+
with:
129+
name: github-pages
130+
path: ${{ runner.temp }}/page-packages/*
131+
132+
- name: Deploy to GitHub Pages
133+
id: deployment
134+
uses: actions/deploy-pages@v4

.github/workflows/release-deploy.yml

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)