Skip to content

Commit 6a08dd3

Browse files
committed
reorder workflows
1 parent 3c146a7 commit 6a08dd3

File tree

8 files changed

+93
-58
lines changed

8 files changed

+93
-58
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: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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: write # Needed to create releases, upload assets
18+
id-token: write # For some security tools
19+
20+
jobs:
21+
draft-release:
22+
uses: ./.github/workflows/release.yml
23+
24+
build-binaries:
25+
needs: draft-release
26+
uses: ./.github/workflows/build.yml
27+
with:
28+
release_id: ${{ needs.draft-release.outputs.release_id }}

.github/workflows/docs.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,7 @@ 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
14-
with:
15-
egress-policy: audit
16-
17-
- 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'
12+
- uses: ./.github/workflows/setup-python.yml
2313

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

.github/workflows/landing-page.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,7 @@ 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
18-
with:
19-
egress-policy: audit
20-
21-
- 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"
16+
- uses: ./.github/workflows/setup-python.yml
2717

2818
- name: Install dependencies
2919
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: 15 additions & 18 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,23 @@ 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
26-
with:
27-
python-version: '3.13'
19+
steps:
20+
- uses: ./.github/workflows/setup-python.yml
2821

2922
- name: Determine release info
3023
id: release_info
3124
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
25+
if [[ "${GITHUB_REF}" == "refs/heads/automate-release" ]]; then
26+
TAG="latest"
27+
elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then
28+
TAG="${GITHUB_REF#refs/tags/}"
29+
else
30+
TAG=""
31+
fi
32+
echo "tag=$TAG" >> $GITHUB_OUTPUT
3833
3934
- name: Update latest tag
4035
if: github.ref == 'refs/heads/automate-release'
@@ -45,11 +40,13 @@ jobs:
4540
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4641

4742
- name: Generate release notes
43+
if: ${{ steps.release_info.outputs.tag != '' }}
4844
id: notes
4945
run: |
5046
python script/create_release_notes.py
5147
5248
- name: Create release
49+
if: ${{ steps.release_info.outputs.tag != '' }}
5350
uses: softprops/action-gh-release@5122b4edc95f85501a71628a57dc180a03ec7588 # v2.5.0
5451
with:
5552
tag_name: ${{ steps.release_info.outputs.tag }}

.github/workflows/setup-python.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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: Harden the runner (Audit all outbound calls)
18+
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
19+
with:
20+
egress-policy: audit
21+
22+
- 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: ${{ inputs.python-version }}

.github/workflows/test.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,7 @@ 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
19-
with:
20-
egress-policy: audit
21-
22-
- 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'
17+
- uses: ./.github/workflows/setup-python.yml
2818

2919
- name: Install Subversion (SVN)
3020
run: |

0 commit comments

Comments
 (0)