-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (50 loc) · 1.69 KB
/
Copy pathtag.yml
File metadata and controls
58 lines (50 loc) · 1.69 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
name: tag
on:
workflow_dispatch:
inputs:
version:
description: "Version tag (e.g. 0.1.0)"
required: true
type: string
jobs:
verify-and-tag:
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
steps:
- uses: actions/checkout@v4
with:
ref: master
- name: Check versions match
run: |
TAG="${{ inputs.version }}"
CARGO_VER=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
PY_VER=$(grep '^version' crates/python/pyproject.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
NODE_VER=$(grep '"version"' crates/node/package.json | head -1 | sed 's/.*"version"[[:space:]]*:[[:space:]]*"\(.*\)".*/\1/')
echo "Tag: $TAG"
echo "Cargo.toml: $CARGO_VER"
echo "pyproject.toml: $PY_VER"
echo "package.json: $NODE_VER"
if [ "$TAG" != "$CARGO_VER" ]; then
echo "ERROR: tag $TAG != Cargo.toml $CARGO_VER"
exit 1
fi
if [ "$TAG" != "$PY_VER" ]; then
echo "ERROR: tag $TAG != pyproject.toml $PY_VER"
exit 1
fi
if [ "$TAG" != "$NODE_VER" ]; then
echo "ERROR: tag $TAG != package.json $NODE_VER"
exit 1
fi
echo "All 3 versions match $TAG. Creating tag."
- name: Create tag
run: |
git tag "${{ inputs.version }}"
git push origin "${{ inputs.version }}"
- name: Trigger release workflow
run: |
gh workflow run release.yml --ref master -f version="${{ inputs.version }}"
env:
GH_TOKEN: ${{ github.token }}