|
| 1 | +name: Release |
| 2 | + |
1 | 3 | on: |
2 | 4 | push: |
3 | 5 | tags: |
|
6 | 8 | jobs: |
7 | 9 | release: |
8 | 10 | runs-on: ubuntu-latest |
9 | | - strategy: |
10 | | - matrix: |
11 | | - BUILD_TARGET: [x86_64-unknown-linux-gnu] |
12 | 11 | steps: |
13 | | - - uses: actions/checkout@v4 |
14 | | - - uses: actions/cache@v4 |
| 12 | + - uses: actions/checkout@v5 |
| 13 | + - name: Set up Go |
| 14 | + uses: actions/setup-go@v5 |
15 | 15 | with: |
16 | | - path: | |
17 | | - ~/.cargo/bin/ |
18 | | - ~/.cargo/registry/index/ |
19 | | - ~/.cargo/registry/cache/ |
20 | | - ~/.cargo/git/db/ |
21 | | - target/ |
22 | | - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
23 | | - |
24 | | - - name: Set environment variable |
25 | | - run: | |
26 | | - PACKAGE_NAME=$(echo ${{ github.repository }} | sed -e "s#.*/##") |
27 | | - VERSION=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g") |
28 | | - echo "PACKAGE_NAME=${PACKAGE_NAME}" >> "$GITHUB_ENV" |
29 | | - echo "VERSION=${VERSION}" >> "$GITHUB_ENV" |
30 | | -
|
31 | | - - name: Run tests |
32 | | - run: cargo test |
33 | | - |
34 | | - - name: Build |
35 | | - run: cargo build --release --target ${{ matrix.BUILD_TARGET }} |
36 | | - |
37 | | - - name: Upload release artifact |
38 | | - uses: actions/upload-artifact@v4 |
| 16 | + go-version: '1.25' |
| 17 | + cache: true |
| 18 | + - name: Run GoReleaser |
| 19 | + uses: goreleaser/goreleaser-action@v6 |
39 | 20 | with: |
40 | | - name: ${{ env.PACKAGE_NAME }}-${{ env.VERSION }}-${{ matrix.BUILD_TARGET }} |
41 | | - path: target/${{ matrix.BUILD_TARGET }}/release/${{ env.PACKAGE_NAME }} |
42 | | - |
43 | | - - name: Download release artifact |
44 | | - uses: actions/download-artifact@v4 |
45 | | - with: |
46 | | - name: ${{ env.PACKAGE_NAME }}-${{ env.VERSION }}-${{ matrix.BUILD_TARGET }} |
47 | | - path: ./artifacts/${{ env.PACKAGE_NAME }}-${{ env.VERSION }}-${{ matrix.BUILD_TARGET }} |
48 | | - |
49 | | - - name: Compress release artifact |
50 | | - run: | |
51 | | - BASENAME="${{ env.PACKAGE_NAME }}-${{ env.VERSION }}-${{ matrix.BUILD_TARGET }}" |
52 | | - mkdir -p ./releases/ |
53 | | - chmod +x "./artifacts/${BASENAME}/${PACKAGE_NAME}" |
54 | | - tar -zcf "./releases/${BASENAME}.tar.gz" -C "./artifacts/${BASENAME}" $(ls -A "./artifacts/${BASENAME}") |
55 | | -
|
56 | | - - name: Upload built binary to GitHub releases |
57 | | - run: | |
58 | | - gh release upload ${VERSION} ./releases/* |
| 21 | + distribution: goreleaser |
| 22 | + args: release --clean |
59 | 23 | env: |
60 | | - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 24 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments