-
Notifications
You must be signed in to change notification settings - Fork 5
94 lines (80 loc) · 2.72 KB
/
CreateRelease.yml
File metadata and controls
94 lines (80 loc) · 2.72 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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Create a Release
on:
workflow_dispatch:
push:
branches: [main]
tags:
- "v*"
permissions:
id-token: write # needed for trusted publishing (OIDC) to npm and crates.io
contents: write # needed to create a release
jobs:
build:
uses: ./.github/workflows/dep_build.yml
secrets: inherit
with:
environment: release
benchmarks:
uses: ./.github/workflows/dep_benchmarks.yml
secrets: inherit
with:
download-benchmarks: true
upload-benchmarks: true
environment: release
set-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-version.outputs.version }}
dry_run: ${{ steps.set-version.outputs.dry_run }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
- name: Set version
id: set-version
shell: bash
run: |
git fetch --tags || true
# Extract the version number from the tag name, which is expected to be in the format 'vX.Y.Z'
# if not, default to '0.0.0' to avoid errors in subsequent steps
if [[ "${GITHUB_REF}" =~ refs/tags/v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
version="${BASH_REMATCH[1]}"
dry_run=false
else
version="0.0.0"
dry_run=true
fi
echo "Setting version to 'v$version'"
echo "version=$version" >> $GITHUB_OUTPUT
echo "dry_run=$dry_run" >> $GITHUB_OUTPUT
create-release-branch:
needs: [build, benchmarks, set-version]
runs-on: ubuntu-latest
if: ${{ needs.set-version.outputs.dry_run == 'false' }}
steps:
- uses: actions/checkout@v6
- name: Create Release Branch
shell: bash
run: |
git checkout -b release/v${{ needs.set-version.outputs.version }}
git push --set-upstream origin release/v${{ needs.set-version.outputs.version }}
publish-gh-release:
needs: [build, benchmarks, set-version]
uses: ./.github/workflows/gh-publish.yml
with:
version: ${{ needs.set-version.outputs.version }}
dry_run: ${{ needs.set-version.outputs.dry_run != 'false' }}
publish-npm-packages:
needs: [build, benchmarks, set-version]
uses: ./.github/workflows/npm-publish.yml
with:
version: ${{ needs.set-version.outputs.version }}
dry_run: ${{ needs.set-version.outputs.dry_run != 'false' }}
publish-cargo-crates:
needs: [build, benchmarks, set-version]
uses: ./.github/workflows/cargo-publish.yml
with:
version: ${{ needs.set-version.outputs.version }}
dry_run: ${{ needs.set-version.outputs.dry_run != 'false' }}