Skip to content

Commit 55a519b

Browse files
👷 launch a new version only if a new version is created
1 parent a5509b7 commit 55a519b

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,47 @@ name: "build and publish cross"
33
on: workflow_dispatch
44

55
jobs:
6+
check-version:
7+
runs-on: ubuntu-latest
8+
outputs:
9+
should_release: ${{ steps.check_version.outputs.should_release }}
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
15+
- name: Get latest tag
16+
id: get_latest_tag
17+
run: |
18+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
19+
echo "LATEST_TAG=${LATEST_TAG}" >> $GITHUB_ENV
20+
echo "Latest tag: ${LATEST_TAG}"
21+
22+
- name: Extract version from tauri.conf.json
23+
id: extract_version
24+
run: |
25+
VERSION=$(grep -o '"version": "[^"]*"' ./postier-app/src-tauri/tauri.conf.json | cut -d '"' -f 4)
26+
echo "CONF_VERSION=${VERSION}" >> $GITHUB_ENV
27+
echo "Config version: ${VERSION}"
28+
29+
- name: Check if versions are different
30+
id: check_version
31+
run: |
32+
LATEST_TAG_VERSION=${LATEST_TAG#v}
33+
echo "Latest tag version (without v): ${LATEST_TAG_VERSION}"
34+
echo "Config version: ${CONF_VERSION}"
35+
36+
if [ "$LATEST_TAG_VERSION" != "$CONF_VERSION" ]; then
37+
echo "Versions are different, should release"
38+
echo "should_release=true" >> $GITHUB_OUTPUT
39+
else
40+
echo "Versions are the same, should not release"
41+
echo "should_release=false" >> $GITHUB_OUTPUT
42+
fi
43+
644
publish-tauri:
45+
needs: check-version
46+
if: needs.check-version.outputs.should_release == 'true'
747
permissions:
848
contents: write
949
strategy:

0 commit comments

Comments
 (0)