@@ -15,15 +15,30 @@ jobs:
15
15
runs-on : ubuntu-20.04
16
16
steps :
17
17
- uses : actions/checkout@v2
18
- with :
19
- ref : main
18
+ # TODO: Unfortunately it's not obvious how to restrict `workflow_dispatch` to a particular branch
19
+ # so this step ensures releases are always done off of `main`.
20
+ - name : Ensure branch is 'main'
21
+ run : |
22
+ git fetch origin &> /dev/null
23
+ branch="$(git rev-parse --abbrev-ref HEAD)"
24
+ if [[ "${branch}" != "main" ]]; then
25
+ echo "The release branch must be main. Got '${branch}'' instead." >&2
26
+ exit 1
27
+ else
28
+ echo "Branch is '${branch}'"
29
+ fi
20
30
- name : Ensure release does not already exist
21
31
run : |
32
+ git fetch origin &> /dev/null
22
33
version="$(grep 'VERSION =' ${{ github.workspace }}/version.bzl | sed 's/VERSION = "//' | sed 's/"//')"
23
34
if [[ -n "$(git tag -l ${version})" ]]; then
24
35
echo "A release '${version}' already exists." >&2
36
+ exit 1
37
+ else
38
+ echo "Tag '${version}' will be created"
25
39
fi
26
40
builds :
41
+ needs : validation
27
42
runs-on : ${{ matrix.os }}
28
43
strategy :
29
44
matrix :
52
67
TARGET : " x86_64-unknown-linux-musl"
53
68
steps :
54
69
- uses : actions/checkout@v2
55
- with :
56
- ref : " ${{ github.base_ref }}"
57
70
- name : Install rust toolchains for host
58
71
run : |
59
72
# Detect the current version of rust
92
105
runs-on : ubuntu-20.04
93
106
steps :
94
107
- uses : actions/checkout@v2
95
- with :
96
- ref : main
97
108
- uses : actions/download-artifact@v2
98
109
with :
99
110
path : ${{ github.workspace }}/crate_universe/target/artifacts
0 commit comments