|
| 1 | +name: Release |
| 2 | + |
1 | 3 | on: |
2 | | - release: |
3 | | - types: [created] |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
4 | 7 |
|
5 | 8 | jobs: |
6 | | - release: |
7 | | - name: release ${{ matrix.target }} |
8 | | - runs-on: ubuntu-24.04 |
| 9 | + build: |
| 10 | + name: Build ${{ matrix.target }} |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + permissions: |
| 13 | + contents: read |
9 | 14 | strategy: |
10 | | - fail-fast: false |
11 | 15 | matrix: |
12 | | - target: [x86_64-unknown-linux-musl] |
| 16 | + include: |
| 17 | + ## Linux builds |
| 18 | + # Musl 1.2.3 |
| 19 | + - os: ubuntu-latest |
| 20 | + target: x86_64-unknown-linux-musl |
| 21 | + artifact_name: target/x86_64-unknown-linux-musl/release/richclip |
| 22 | + |
| 23 | + ## macOS builds |
| 24 | + - os: macos-latest |
| 25 | + target: x86_64-apple-darwin |
| 26 | + artifact_name: target/x86_64-apple-darwin/release/richclip |
| 27 | + - os: macos-latest |
| 28 | + target: aarch64-apple-darwin |
| 29 | + artifact_name: target/aarch64-apple-darwin/release/richclip |
| 30 | + |
13 | 31 | steps: |
14 | 32 | - uses: actions/checkout@v4 |
15 | | - - name: Compile and release |
16 | | - uses: rust-build/[email protected] |
17 | | - env: |
18 | | - GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} |
19 | | - ARCHIVE_TYPES: tar.gz |
20 | 33 | with: |
21 | | - RUSTTARGET: ${{ matrix.target }} |
22 | | - TOOLCHAIN_VERSION: 1.83.0 |
23 | | - PRE_BUILD: ".github/workflows/release_pre_build.sh" |
| 34 | + persist-credentials: false |
| 35 | + |
| 36 | + - name: Build binary |
| 37 | + uses: houseabsolute/actions-rust-cross@v1 |
| 38 | + with: |
| 39 | + command: build |
| 40 | + target: ${{ matrix.target }} |
| 41 | + args: "--locked --release" |
| 42 | + strip: true |
| 43 | + |
| 44 | + - name: Upload artifacts |
| 45 | + uses: actions/upload-artifact@v4 |
| 46 | + with: |
| 47 | + name: ${{ matrix.target }} |
| 48 | + path: ${{ matrix.target }}.* |
| 49 | + |
| 50 | + release: |
| 51 | + name: Release |
| 52 | + needs: build |
| 53 | + runs-on: ubuntu-latest |
| 54 | + permissions: |
| 55 | + contents: write |
| 56 | + steps: |
| 57 | + - name: Download artifacts |
| 58 | + uses: actions/download-artifact@v4 |
| 59 | + |
| 60 | + - name: Generate checksums |
| 61 | + run: | |
| 62 | + for file in ./**/*; do |
| 63 | + sha256sum "$file" > "${file}.sha256" |
| 64 | + done |
| 65 | +
|
| 66 | + - name: Upload Release Assets |
| 67 | + uses: softprops/action-gh-release@v2 |
| 68 | + with: |
| 69 | + name: ${{ github.ref_name }} |
| 70 | + tag_name: ${{ github.ref_name }} |
| 71 | + token: ${{ github.token }} |
| 72 | + files: ./**/* |
| 73 | + draft: true |
| 74 | + prerelease: false |
| 75 | + generate_release_notes: true |
0 commit comments