Skip to content

Commit 53cfa6b

Browse files
committed
reorder workflows
1 parent 3c146a7 commit 53cfa6b

File tree

8 files changed

+97
-48
lines changed

8 files changed

+97
-48
lines changed

.github/workflows/build.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
name: Build
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
pull_request:
8-
types: [opened, synchronize, reopened]
4+
workflow_call:
5+
inputs:
6+
release_id:
7+
required: true
8+
type: string
99

1010
permissions:
1111
contents: read
1212

1313
jobs:
1414

1515
build:
16-
needs: prepare-release
1716
strategy:
1817
matrix:
1918
platform: [ubuntu-latest, macos-latest, windows-latest]
@@ -96,6 +95,20 @@ jobs:
9695
build/dfetch-package/*.msi
9796
build/dfetch-package/*.cdx.json
9897
98+
- name: Upload artifacts to release
99+
if: ${{ inputs.release_id }} != ''
100+
uses: softprops/action-gh-release@5122b4edc95f85501a71628a57dc180a03ec7588 # v2.5.0
101+
with:
102+
release_id: ${{ inputs.release_id }}
103+
files: |
104+
build/dfetch-package/*.deb
105+
build/dfetch-package/*.rpm
106+
build/dfetch-package/*.pkg
107+
build/dfetch-package/*.msi
108+
build/dfetch-package/*.cdx.json
109+
env:
110+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111+
99112
test-binary:
100113
name: test binary
101114
needs:

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI & Release Orchestration
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- automate-release
8+
tags:
9+
- '*.*.*'
10+
pull_request:
11+
types: [opened, synchronize, reopened]
12+
13+
# Allows to run this workflow manually
14+
workflow_dispatch:
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
draft-release:
21+
uses: ./.github/workflows/release.yml
22+
permissions:
23+
contents: write
24+
security-events: write
25+
26+
build-binaries:
27+
needs: draft-release
28+
uses: ./.github/workflows/build.yml
29+
permissions:
30+
contents: read
31+
security-events: write
32+
with:
33+
release_id: ${{ needs.draft-release.outputs.release_id }}

.github/workflows/docs.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,11 @@ jobs:
99
docs:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: Harden the runner (Audit all outbound calls)
13-
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
12+
- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
1413
with:
1514
egress-policy: audit
16-
1715
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5.0.0
18-
19-
- name: Install Python
20-
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
21-
with:
22-
python-version: '3.x'
16+
- uses: ./.github/workflows/setup-python.yml
2317

2418
- name: Install documentation requirements
2519
run: "pip install .[docs] && pip install sphinx_design"

.github/workflows/landing-page.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,11 @@ jobs:
1313
publish:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- name: Harden the runner (Audit all outbound calls)
17-
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
16+
- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
1817
with:
1918
egress-policy: audit
20-
2119
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5.0.0
22-
23-
- name: Setup Python
24-
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
25-
with:
26-
python-version: "3.13"
20+
- uses: ./.github/workflows/setup-python.yml
2721

2822
- name: Install dependencies
2923
run: |

.github/workflows/python-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name: Upload Python Package
55

66
on:
77
release:
8-
types: [created]
8+
types: [published]
99
pull_request:
1010
types: [opened, synchronize, reopened]
1111

.github/workflows/release.yml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
name: Releases
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
- automate-release
8-
tags:
9-
- '*.*.*'
4+
workflow_call:
105

116
permissions:
127
contents: read
@@ -18,23 +13,27 @@ jobs:
1813
contents: write
1914
security-events: write
2015

21-
steps:
22-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5.0.0
16+
outputs:
17+
release_id: ${{ steps.release_info.outputs.tag }}
2318

24-
- name: Setup Python
25-
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
19+
steps:
20+
- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
2621
with:
27-
python-version: '3.13'
22+
egress-policy: audit
23+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5.0.0
24+
- uses: ./.github/workflows/setup-python.yml
2825

2926
- name: Determine release info
3027
id: release_info
3128
run: |
32-
if [[ "${GITHUB_REF}" == "refs/heads/automate-release" ]]; then
33-
TAG="latest"
34-
else
35-
TAG="${GITHUB_REF#refs/tags/}"
36-
fi
37-
echo "tag=$TAG" >> $GITHUB_OUTPUT
29+
if [[ "${GITHUB_REF}" == "refs/heads/automate-release" ]]; then
30+
TAG="latest"
31+
elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then
32+
TAG="${GITHUB_REF#refs/tags/}"
33+
else
34+
TAG=""
35+
fi
36+
echo "tag=$TAG" >> $GITHUB_OUTPUT
3837
3938
- name: Update latest tag
4039
if: github.ref == 'refs/heads/automate-release'
@@ -45,11 +44,13 @@ jobs:
4544
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4645

4746
- name: Generate release notes
47+
if: ${{ steps.release_info.outputs.tag != '' }}
4848
id: notes
4949
run: |
5050
python script/create_release_notes.py
5151
5252
- name: Create release
53+
if: ${{ steps.release_info.outputs.tag != '' }}
5354
uses: softprops/action-gh-release@5122b4edc95f85501a71628a57dc180a03ec7588 # v2.5.0
5455
with:
5556
tag_name: ${{ steps.release_info.outputs.tag }}

.github/workflows/setup-python.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Setup Python Environment
2+
3+
on:
4+
workflow_call: # Makes this workflow reusable
5+
inputs:
6+
python-version: # Optional input
7+
required: false
8+
type: string
9+
default: '3.13'
10+
11+
jobs:
12+
setup:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
python-version: ${{ inputs.python-version }}
16+
steps:
17+
- name: Setup Python
18+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
19+
with:
20+
python-version: ${{ inputs.python-version }}

.github/workflows/test.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,11 @@ jobs:
1414
test:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- name: Harden the runner (Audit all outbound calls)
18-
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
17+
- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
1918
with:
2019
egress-policy: audit
21-
2220
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5.0.0
23-
24-
- name: Setup Python
25-
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
26-
with:
27-
python-version: '3.13'
21+
- uses: ./.github/workflows/setup-python.yml
2822

2923
- name: Install Subversion (SVN)
3024
run: |

0 commit comments

Comments
 (0)