|
| 1 | +name: publish |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - release-*.*.* |
| 7 | + branches: |
| 8 | + - main |
| 9 | + - master |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + publish: |
| 16 | + name: ${{ matrix.name }} |
| 17 | + |
| 18 | + runs-on: ${{ matrix.os }} |
| 19 | + |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + os: [macos-latest, windows-latest] |
| 23 | + include: |
| 24 | + - os: macos-latest |
| 25 | + name: MacOS Binary 64-Bit |
| 26 | + target: x86_64-apple-darwin |
| 27 | + target2: aarch64-apple-darwin |
| 28 | + env: |
| 29 | + MACOSX_DEPLOYMENT_TARGET: 10.7 |
| 30 | + |
| 31 | + - os: windows-latest |
| 32 | + name: Windows Binary 64-Bit |
| 33 | + target: x86_64-pc-windows-msvc |
| 34 | + |
| 35 | + steps: |
| 36 | + - name: Check out repository |
| 37 | + uses: actions/checkout@v4 |
| 38 | + |
| 39 | + - name: Add rustup default target |
| 40 | + run: rustup target add ${{ matrix.target }} |
| 41 | + |
| 42 | + - name: Add rustup Apple ARM64 target |
| 43 | + if: ${{ matrix.os == 'macos-latest' }} |
| 44 | + run: rustup target add ${{ matrix.target2 }} |
| 45 | + |
| 46 | + - name: Build default target in release mode |
| 47 | + run: cargo build --release --target ${{ matrix.target }} --locked |
| 48 | + |
| 49 | + - name: Build Apple ARM64 target in release mode |
| 50 | + if: ${{ matrix.os == 'macos-latest' }} |
| 51 | + run: cargo build --release --target ${{ matrix.target2 }} --locked |
| 52 | + |
| 53 | + - name: Create zip file on Windows |
| 54 | + if: ${{ matrix.os == 'windows-latest' }} |
| 55 | + run: | |
| 56 | + choco install zip |
| 57 | + cd target/${{ matrix.target }}/release |
| 58 | + zip lc-0.1.0-${{ matrix.target }}.zip lc.exe |
| 59 | + cd ../../.. |
| 60 | +
|
| 61 | + - name: Create tar.gz file on macOS |
| 62 | + if: ${{ matrix.os == 'macos-latest' }} |
| 63 | + run: | |
| 64 | + chmod +x target/${{ matrix.target }}/release/lc |
| 65 | + tar -zcf target/${{ matrix.target }}/release/lc-0.1.0-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release lc |
| 66 | + chmod +x target/${{ matrix.target2 }}/release/lc |
| 67 | + tar -zcf target/${{ matrix.target2 }}/release/lc-0.1.0-${{ matrix.target2 }}.tar.gz -C target/${{ matrix.target2 }}/release lc |
| 68 | +
|
| 69 | + - name: Upload release and assets to GitHub |
| 70 | + uses: svenstaro/upload-release-action@v2 |
| 71 | + with: |
| 72 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 73 | + tag: "release-0.1.0-${{ github.run_number }}" |
| 74 | + release_name: lc 0.1.0 |
| 75 | + file_glob: true |
| 76 | + file: target/*/release/lc-0.1.0-*.{zip,tar.gz} |
0 commit comments