@@ -2,11 +2,10 @@ name: Rust
22on :
33 push :
44 branches : [master]
5- workflow_dispatch :
65env :
76 CARGO_TERM_COLOR : always
87jobs :
9- Setup :
8+ setup :
109 runs-on : ubuntu-latest
1110 outputs :
1211 version : ${{ steps.read.outputs.version }}
@@ -50,22 +49,22 @@ jobs:
5049 echo "tag=v$VERSION" >> $GITHUB_OUTPUT
5150 echo "package_name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
5251
53- Check :
54- needs : Setup
52+ check :
53+ needs : setup
5554 runs-on : ubuntu-latest
5655 steps :
5756 - name : Checkout
5857 uses : actions/checkout@v4
59- - name : Setup rust
58+ - name : setup rust
6059 uses : dtolnay/rust-toolchain@stable
6160 with :
6261 toolchain : stable
6362 components : rustfmt
6463 - name : Format check
6564 run : cargo fmt -- --check
6665
67- Tests :
68- needs : Setup
66+ tests :
67+ needs : setup
6968 runs-on : ubuntu-latest
7069 steps :
7170 - name : Checkout
7776 - name : Run tests
7877 run : cargo test --all-features -- --nocapture
7978
80- Clippy :
81- needs : Setup
79+ clippy :
80+ needs : setup
8281 runs-on : ubuntu-latest
8382 steps :
8483 - name : Checkout
@@ -91,22 +90,22 @@ jobs:
9190 - name : Run clippy
9291 run : cargo clippy --all-features -- -A warnings
9392
94- Build :
95- needs : Setup
93+ build :
94+ needs : setup
9695 runs-on : ubuntu-latest
9796 steps :
9897 - name : Checkout
9998 uses : actions/checkout@v4
100- - name : Setup build
99+ - name : setup build
101100 uses : dtolnay/rust-toolchain@stable
102101 with :
103102 toolchain : stable
104- - name : Build release
103+ - name : build release
105104 run : cargo check --release --all-features
106105
107- Publish :
108- needs : [Setup, Check, Tests, Clippy, Build ]
109- if : needs.Setup .outputs.tag != ''
106+ publish :
107+ needs : [setup, check, tests, clippy, build ]
108+ if : needs.setup .outputs.tag != ''
110109 runs-on : ubuntu-latest
111110 outputs :
112111 published : ${{ steps.publish.outputs.published }}
@@ -118,7 +117,7 @@ jobs:
118117 with :
119118 path : ~/.cargo/bin/toml
120119 key : toml-cli-${{ runner.os }}
121- - name : Publish to crates.io
120+ - name : publish to crates.io
122121 id : publish
123122 env :
124123 CARGO_REGISTRY_TOKEN : ${{ secrets.CARGO_REGISTRY_TOKEN }}
@@ -127,7 +126,7 @@ jobs:
127126 echo "published=false" >> $GITHUB_OUTPUT
128127 echo "${{ secrets.CARGO_REGISTRY_TOKEN }}" | cargo login
129128 PACKAGE_NAME=$(toml get Cargo.toml package.name --raw)
130- VERSION=${{ needs.Setup .outputs.version }}
129+ VERSION=${{ needs.setup .outputs.version }}
131130 if cargo publish --allow-dirty; then
132131 echo "published=true" >> $GITHUB_OUTPUT
133132 echo "🎉🎉🎉 PUBLISH SUCCESSFUL 🎉🎉🎉"
@@ -138,12 +137,12 @@ jobs:
138137 echo "❌ Publish failed"
139138 fi
140139
141- Release :
142- needs : [Setup, Check, Tests, Clippy, Build ]
140+ release :
141+ needs : [setup, check, tests, clippy, build ]
143142 permissions :
144143 contents : write
145144 packages : write
146- if : needs.Setup .outputs.tag != ''
145+ if : needs.setup .outputs.tag != ''
147146 runs-on : ubuntu-latest
148147 outputs :
149148 released : ${{ steps.release.outputs.released }}
@@ -155,33 +154,33 @@ jobs:
155154 - name : Get package name
156155 id : package_info
157156 run : |
158- echo "package_name=${{ needs.Setup .outputs.package_name }}" >> $GITHUB_OUTPUT
159- - name : Check tag status
157+ echo "package_name=${{ needs.setup .outputs.package_name }}" >> $GITHUB_OUTPUT
158+ - name : check tag status
160159 id : check_tag
161160 run : |
162- if git tag -l | grep -q "^${{ needs.Setup .outputs.tag }}$"; then
161+ if git tag -l | grep -q "^${{ needs.setup .outputs.tag }}$"; then
163162 echo "tag_exists=true" >> $GITHUB_OUTPUT
164- echo "🏷️ Tag ${{ needs.Setup .outputs.tag }} exists locally"
163+ echo "🏷️ Tag ${{ needs.setup .outputs.tag }} exists locally"
165164 else
166165 echo "tag_exists=false" >> $GITHUB_OUTPUT
167- echo "🏷️ Tag ${{ needs.Setup .outputs.tag }} does not exist locally"
166+ echo "🏷️ Tag ${{ needs.setup .outputs.tag }} does not exist locally"
168167 fi
169- if git ls-remote --tags origin | grep -q "refs/tags/${{ needs.Setup .outputs.tag }}$"; then
168+ if git ls-remote --tags origin | grep -q "refs/tags/${{ needs.setup .outputs.tag }}$"; then
170169 echo "remote_tag_exists=true" >> $GITHUB_OUTPUT
171- echo "🌐 Tag ${{ needs.Setup .outputs.tag }} exists on remote"
170+ echo "🌐 Tag ${{ needs.setup .outputs.tag }} exists on remote"
172171 else
173172 echo "remote_tag_exists=false" >> $GITHUB_OUTPUT
174- echo "🌐 Tag ${{ needs.Setup .outputs.tag }} does not exist on remote"
173+ echo "🌐 Tag ${{ needs.setup .outputs.tag }} does not exist on remote"
175174 fi
176- - name : Check release status
175+ - name : check release status
177176 id : check_release
178177 run : |
179- if gh release view "${{ needs.Setup .outputs.tag }}" > /dev/null 2>&1; then
178+ if gh release view "${{ needs.setup .outputs.tag }}" > /dev/null 2>&1; then
180179 echo "release_exists=true" >> $GITHUB_OUTPUT
181- echo "📦 Release ${{ needs.Setup .outputs.tag }} already exists"
180+ echo "📦 Release ${{ needs.setup .outputs.tag }} already exists"
182181 else
183182 echo "release_exists=false" >> $GITHUB_OUTPUT
184- echo "📦 Release ${{ needs.Setup .outputs.tag }} does not exist"
183+ echo "📦 Release ${{ needs.setup .outputs.tag }} does not exist"
185184 fi
186185 env :
187186 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -191,8 +190,8 @@ jobs:
191190 set -e
192191 echo "released=false" >> $GITHUB_OUTPUT
193192 PACKAGE_NAME="${{ steps.package_info.outputs.package_name }}"
194- VERSION="${{ needs.Setup .outputs.version }}"
195- TAG="${{ needs.Setup .outputs.tag }}"
193+ VERSION="${{ needs.setup .outputs.version }}"
194+ TAG="${{ needs.setup .outputs.tag }}"
196195 echo "📦 Building source archives..."
197196 git archive --format=zip --prefix="${PACKAGE_NAME}-${VERSION}/" HEAD > "${PACKAGE_NAME}-${VERSION}.zip"
198197 git archive --format=tar.gz --prefix="${PACKAGE_NAME}-${VERSION}/" HEAD > "${PACKAGE_NAME}-${VERSION}.tar.gz"
@@ -231,7 +230,7 @@ jobs:
231230 echo "🆕 Creating new release: $TAG"
232231 if gh release create "$TAG" \
233232 --title "$TAG (Created $(date '+%Y-%m-%d %H:%M:%S'))" \
234- --notes "Release $TAG - First published at $(date '+%Y-%m-%d %H:%M:%S UTC')
233+ --notes "Release $TAG - Created at $(date '+%Y-%m-%d %H:%M:%S UTC')
235234 ## Changes
236235 - Version: $VERSION
237236 - Package: $PACKAGE_NAME
0 commit comments