Skip to content

Commit de17379

Browse files
committed
ci: writes version to output instead of env and removes unnecessary version comparison
1 parent c3fb761 commit de17379

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

.github/workflows/deploy.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,19 @@ jobs:
3232
fetch-depth: 0
3333

3434
- name: Get version
35-
run: echo "VERSION=$(cat Cargo.toml | grep version | head -n1 | cut -d '"' -f2)" >> "$GITHUB_ENV"
35+
id: get_version
36+
run: echo "version=$(cat Cargo.toml | grep version | head -n1 | cut -d '"' -f2)" >> "$GITHUB_OUTPUT"
3637

3738
- uses: rickstaa/action-create-tag@v1
3839
id: tag_create
3940
with:
40-
tag: v${{ env.VERSION }}
41-
42-
- name: Check if release is needed
43-
id: check
44-
run: |
45-
last_version=$(git describe --tags --abbrev=0)
46-
if [[ "$VERSION" == "$last_version" ]]; then
47-
# no release needed
48-
echo "create_release=false" >> "$GITHUB_OUTPUT"
49-
else
50-
echo "create_release=true" >> "$GITHUB_OUTPUT"
51-
fi
41+
tag: v${{ steps.get_version.outputs.version }}
5242

5343
- name: Create Release
54-
if: steps.check.outputs.create_release == 'true'
44+
if: !steps.tag_create.outputs.tag_exists
5545
uses: actions/create-release@v1
5646
env:
5747
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5848
with:
59-
tag_name: v${{ env.VERSION }}
60-
release_name: v${{ env.VERSION }}
49+
tag_name: v${{ steps.get_version.outputs.version }}
50+
release_name: v${{ steps.get_version.outputs.version }}

0 commit comments

Comments
 (0)