Skip to content

Commit 95ad6ba

Browse files
committed
ci: refactor push and pr ci
refactors the CI to only run on prs and makes only release and docs publication run on pushes on main. Signed-off-by: Luca Zaninotto <luca.zaninotto@secomind.com>
1 parent 4588947 commit 95ad6ba

3 files changed

Lines changed: 25 additions & 32 deletions

File tree

.github/actions/backend/publish-doc.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ inputs:
2727
runs:
2828
using: "composite"
2929
steps:
30-
# Upload as an artifact the generated HTML
31-
- name: Upload HTML documentation
32-
uses: actions/upload-artifact@v6
33-
with:
34-
name: docs_html
35-
path: ${{ inputs.docs }}
36-
3730
# Commit and push changes to the docs repository
3831
- name: Commit files
3932
working-directory: ${{ inputs.docs }}

.github/workflows/docs-workflow.yaml

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,16 @@
1919

2020
name: Edgehog docs generation
2121

22+
# publish Generate and publish docs on pushes on main (or release branches) only
23+
# when backend or frontend files are touched.
2224
on:
23-
push:
24-
paths:
25-
# Documentation pages
26-
- "backend/docs/**"
27-
# Schema files
28-
- "backend/lib/edgehog_web/admin_api/**"
29-
- "backend/lib/edgehog_web/schema.ex"
30-
- "backend/lib/edgehog_web/schema/**"
31-
# Ash resources, including new Ash domains
32-
- "backend/lib/edgehog/**"
33-
- "backend/mix.exs"
34-
- "backend/mix.lock"
35-
# SpectaQL configuration file
36-
- "backend/.spectaql-config.yaml"
37-
# The action itself, Elixir and Node.js versions
38-
- ".tool-versions"
39-
- ".github/workflows/docs-workflow.yaml"
40-
branches:
41-
# Create the snapshot only when it matters
42-
- "main"
43-
- "release-*"
25+
workflow_call:
26+
inputs:
27+
release-made:
28+
required: true
29+
type: boolean
30+
release-version:
31+
type: string
4432

4533
concurrency:
4634
group: "${{ github.workflow }}-${{ github.ref }}"
@@ -78,11 +66,17 @@ jobs:
7866
repository: edgehog-device-manager/edgehog-astarte-interfaces
7967
path: edgehog-astarte-interfaces
8068
show-progress: false
81-
- uses: .github/actions/gen-doc.yaml
69+
- name: Compute docs version
70+
id: compute-version
71+
run: |
72+
version=$(${{ inputs.release-made }} && echo ${{ inputs.release-version }} || echo "snapshot")
73+
echo "version=$version" >> $GITHUB_OUTPUT
74+
- uses: .github/actions/backend/gen-doc.yaml
8275
with:
8376
edgehog: edgehog
8477
docs: docs
8578
astarte-interfaces: edgehog-astarte-interfaces
86-
- uses: .github/actions/publish-doc.yaml
79+
version: ${{ steps.compute-version.outputs.version }}
80+
- uses: .github/actions/backend/publish-doc.yaml
8781
with:
8882
docs: docs
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,19 @@ permissions:
2626
issues: write
2727
pull-requests: write
2828

29-
name: release-please
29+
name: Release CI
3030

3131
jobs:
32-
release-please:
32+
make-release:
3333
runs-on: ubuntu-latest
3434
steps:
3535
- uses: googleapis/release-please-action@v4
3636
with:
3737
config-file: .github/release-please/config.json
3838
manifest-file: .github/release-please/manifest.json
39+
publish-docs:
40+
needs: [make-release]
41+
uses: .github/workflows/docs-workflow.yaml
42+
with:
43+
release-made: ${{ needs.make-release.outputs.backend--release_created }}
44+
release-version: ${{ needs.make-release.outputs.backend--version }}

0 commit comments

Comments
 (0)