|
10 | 10 | BINARY_NAME: yanimator |
11 | 11 |
|
12 | 12 | jobs: |
13 | | - check-version: |
14 | | - runs-on: ubuntu-latest |
15 | | - outputs: |
16 | | - should_release: ${{ steps.check_version.outputs.should_release }} |
17 | | - version: ${{ steps.get_version.outputs.version }} |
18 | | - steps: |
19 | | - - uses: actions/checkout@v4 |
20 | | - |
21 | | - - name: Get Cargo.toml version |
22 | | - id: get_version |
23 | | - run: | |
24 | | - version=$(sed -n 's/^version = "\([^"]*\)"/\1/p' Cargo.toml) |
25 | | - echo "version=$version" >> $GITHUB_OUTPUT |
26 | | -
|
27 | | - - name: Check if release needed |
28 | | - id: check_version |
29 | | - run: | |
30 | | - # Get the latest release tag |
31 | | - latest_release=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ |
32 | | - "https://api.github.com/repos/${{ github.repository }}/releases/latest" | \ |
33 | | - grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/' || echo "none") |
34 | | - |
35 | | - # Get current version from previous step |
36 | | - current_version="${{ steps.get_version.outputs.version }}" |
37 | | - |
38 | | - if [ "$latest_release" != "$current_version" ]; then |
39 | | - echo "should_release=true" >> $GITHUB_OUTPUT |
40 | | - else |
41 | | - echo "should_release=false" >> $GITHUB_OUTPUT |
42 | | - fi |
43 | | -
|
44 | | - build-and-release: |
45 | | - needs: [check-version] |
46 | | - if: needs.check-version.outputs.should_release == 'true' |
47 | | - runs-on: ubuntu-latest |
48 | | - steps: |
49 | | - - uses: actions/checkout@v4 |
50 | | - |
51 | | - - name: Create Release |
52 | | - id: create_release |
53 | | - uses: actions/create-release@v1 |
54 | | - env: |
55 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
56 | | - with: |
57 | | - tag_name: v${{ needs.check-version.outputs.version }} |
58 | | - release_name: Release v${{ needs.check-version.outputs.version }} |
59 | | - draft: false |
60 | | - prerelease: false |
61 | | - body: | |
62 | | - Release v${{ needs.check-version.outputs.version }} |
63 | | - |
64 | | - Automated release for commit ${{ github.sha }} |
65 | | - Created at: ${{ needs.create-tag.outputs.tag_name }} |
66 | | - Released by: ${{ github.actor }} |
67 | | -
|
68 | 13 | build: |
69 | | - needs: [check-version, build-and-release] |
70 | 14 | if: needs.check-version.outputs.should_release == 'true' |
71 | 15 | runs-on: ${{ matrix.os }} |
72 | 16 | strategy: |
@@ -110,11 +54,9 @@ jobs: |
110 | 54 | cp ${{ matrix.artifact_name }} ../../${{ matrix.asset_name }} |
111 | 55 | fi |
112 | 56 |
|
113 | | - - name: Upload Release Asset |
114 | | - uses: softprops/action-gh-release@v1 |
| 57 | + - name: Upload Artifact |
| 58 | + uses: actions/upload-artifact@v4 |
115 | 59 | with: |
116 | | - files: | |
| 60 | + path: | |
117 | 61 | target/${{ matrix.asset_name }} |
118 | 62 | ${{ env.BINARY_NAME }}-${{ needs.check-version.outputs.version }}-${{ matrix.binstall_suffix }} |
119 | | - tag_name: v${{ needs.check-version.outputs.version }} |
120 | | - token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments