Skip to content

Commit c3e6188

Browse files
only trigger release from master
1 parent 91aca8b commit c3e6188

File tree

2 files changed

+27
-31
lines changed

2 files changed

+27
-31
lines changed

.github/workflows/build.yml

-26
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ jobs:
2525
needs: cargo-deny
2626
steps:
2727
- uses: actions/checkout@v3
28-
with:
29-
fetch-depth: 0
3028
- uses: actions-rs/toolchain@v1
3129
with:
3230
toolchain: stable
@@ -35,27 +33,3 @@ jobs:
3533
- uses: actions-rs/cargo@v1
3634
with:
3735
command: test
38-
- name: Extract version from Cargo.toml
39-
id: extract_version
40-
run: |
41-
VERSION=$(grep '^version = ' Cargo.toml | sed -E 's/version = "(.*)"/\1/')
42-
echo "VERSION=$VERSION" >> $GITHUB_ENV
43-
44-
- name: Check if tag exists
45-
id: check_tag
46-
run: |
47-
if git rev-parse --verify v${VERSION} >/dev/null 2>&1; then
48-
echo "TAG_EXISTS=true" >> $GITHUB_ENV
49-
else
50-
echo "TAG_EXISTS=false" >> $GITHUB_ENV
51-
fi
52-
53-
- name: Create new tag
54-
if: ${{ env.TAG_EXISTS == 'false' }}
55-
run: |
56-
git config --global user.name "${{ github.actor }}"
57-
git config --global user.email "noreply@turingpi.com"
58-
git tag -a "v${{ env.VERSION }}" -m "Release version ${{ env.VERSION }}"
59-
git push origin "v${{ env.VERSION }}"
60-
env:
61-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

+27-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Release Pipeline
22
on:
33
push:
4-
tags:
5-
- 'v[0-9]+.[0-9]+.[0-9]+'
6-
jobs:
4+
branches:
5+
- master
76

7+
jobs:
88
build-pipeline:
99
name: "Build ${{ matrix.target }}"
1010
strategy:
@@ -122,17 +122,39 @@ jobs:
122122
name: ${{ env.PKG_NAME }}.deb
123123
path: ${{ env.PKG_NAME }}.deb
124124

125-
create_release:
126-
needs: debian-packages
125+
create-release:
127126
runs-on: ubuntu-latest
127+
needs: build-pipeline
128128
steps:
129129
- name: Checkout Code
130130
uses: actions/checkout@v4
131+
with:
132+
fetch-depth: 0
131133
- name: Extract version from Cargo.toml
134+
id: extract_version
132135
run: |
133136
VERSION=$(grep '^version = ' Cargo.toml | sed -E 's/version = "(.*)"/\1/')
134137
echo "VERSION=$VERSION" >> $GITHUB_ENV
135138
139+
- name: Check if tag exists
140+
id: check_tag
141+
run: |
142+
if git rev-parse --verify v${VERSION} >/dev/null 2>&1; then
143+
echo "TAG_EXISTS=true" >> $GITHUB_ENV
144+
else
145+
echo "no new version detected, aborting release Pipeline"
146+
exit 0
147+
fi
148+
149+
- name: Create new tag
150+
run: |
151+
git config --global user.name "${{ github.actor }}"
152+
git config --global user.email "noreply@turingpi.com"
153+
git tag -a "v${{ env.VERSION }}" -m "Release version ${{ env.VERSION }}"
154+
git push origin "v${{ env.VERSION }}"
155+
env:
156+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
157+
136158
- name: Download artifacts
137159
uses: actions/download-artifact@v4
138160
with:

0 commit comments

Comments
 (0)