Repository navigation
143 lines (136 loc) · 4.98 KB
/
Copy pathoneflow.yml
File metadata and controls
143 lines (136 loc) · 4.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# OneFlow checks, for a repository with one main branch, from which release and hotfix branches are released and merged back.
# A release/vX.Y.Z branch from the main branch, or a hotfix/vX.Y.Z branch from the last release's tag, sets the version and changelog; its last commit is registered, tagged by TagBot, and merged back by pull request.
# Called from the repository's own workflow, on pull requests into the main branch:
#
# on:
# pull_request:
# branches: [main]
# types: [opened, synchronize, reopened, labeled, unlabeled]
# jobs:
# oneflow:
# uses: BioJulia/Workflows/.github/workflows/oneflow.yml@v1
# permissions:
# contents: read
#
# From a release or hotfix branch: Source branch, Version, Changelog and Breaking changes, on the branch's head commit, which is the release.
# From any other branch: Source branch and Changelog entry.
# The checks that don't apply are skipped, and a skipped check counts as passed, so the ruleset may require every check, as "oneflow / Source branch" and so on.
name: "Reusable: OneFlow"
on:
workflow_call:
inputs:
main-branch:
description: The main branch.
type: string
default: main
skip-label:
description: The label that exempts a pull request from the changelog entry.
type: string
default: skip changelog
check-links:
description: Whether to check the changelog's comparison links.
type: boolean
default: true
project:
description: The package's directory, relative to the repository's root, for a package in a subdirectory.
type: string
default: ''
registry:
description: The registry of the package's releases.
type: string
default: General
permissions: {}
jobs:
source:
name: Source branch
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- uses: BioJulia/Workflows@v1.0.1
with:
check: source
model: oneflow
project: ${{ inputs.project }}
main-branch: ${{ inputs.main-branch }}
registry: ${{ inputs.registry }}
version:
name: Version
if: startsWith(github.head_ref, 'release/') || startsWith(github.head_ref, 'hotfix/')
runs-on: ubuntu-latest
permissions:
contents: read
steps:
# The release is the branch's head commit, not the merge commit; GitHub keeps every pull request's head, so this works for forks too.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: BioJulia/Workflows@v1.0.1
with:
check: version
model: oneflow
project: ${{ inputs.project }}
main-branch: ${{ inputs.main-branch }}
registry: ${{ inputs.registry }}
changelog:
name: Changelog
if: startsWith(github.head_ref, 'release/') || startsWith(github.head_ref, 'hotfix/')
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: BioJulia/Workflows@v1.0.1
with:
check: changelog
model: oneflow
project: ${{ inputs.project }}
main-branch: ${{ inputs.main-branch }}
check-links: ${{ inputs.check-links }}
registry: ${{ inputs.registry }}
breaking:
name: Breaking changes
if: startsWith(github.head_ref, 'release/') || startsWith(github.head_ref, 'hotfix/')
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: julia-actions/setup-julia@da908477b5db94c10ffce8cfea9f2b3b9d5db687 # v3.0.3
with:
version: '1'
- uses: julia-actions/cache@9353db09a0f2bbbdec6f41791918c75d37391b36 # v3.5.0
- uses: BioJulia/Workflows@v1.0.1
with:
check: breaking
model: oneflow
project: ${{ inputs.project }}
main-branch: ${{ inputs.main-branch }}
registry: ${{ inputs.registry }}
entry:
name: Changelog entry
if: ${{ !startsWith(github.head_ref, 'release/') && !startsWith(github.head_ref, 'hotfix/') }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- uses: BioJulia/Workflows@v1.0.1
with:
check: entry
model: oneflow
project: ${{ inputs.project }}
main-branch: ${{ inputs.main-branch }}
skip-label: ${{ inputs.skip-label }}