|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main" ] |
| 6 | + tags: [ "v*" ] |
| 7 | + pull_request: |
| 8 | + branches: [ "main" ] |
| 9 | + |
| 10 | +env: |
| 11 | + CARGO_TERM_COLOR: always |
| 12 | + |
| 13 | +jobs: |
| 14 | + build-windows: |
| 15 | + runs-on: windows-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Build |
| 20 | + run: cargo build --release --features cli-wrapper |
| 21 | + |
| 22 | + - name: Package |
| 23 | + run: | |
| 24 | + $tag = "${{ contains(github.ref_name, '/') && github.sha || github.ref_name }}" |
| 25 | + Compress-Archive -Force -Path ` |
| 26 | + target/release/xlauth.exe, ` |
| 27 | + target/release/xlauth-cli.exe ` |
| 28 | + -DestinationPath "xlauth-windows-$tag.zip" |
| 29 | +
|
| 30 | + - uses: actions/upload-artifact@v4 |
| 31 | + with: |
| 32 | + name: windows-build |
| 33 | + path: xlauth-windows-*.zip |
| 34 | + |
| 35 | + build-linux: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v4 |
| 39 | + |
| 40 | + - name: Build |
| 41 | + run: cargo build --release |
| 42 | + |
| 43 | + - name: Package |
| 44 | + run: | |
| 45 | + tag="${{ contains(github.ref_name, '/') && github.sha || github.ref_name }}" |
| 46 | + tar -czf "xlauth-linux-${tag}.tar.gz" -C target/release xlauth |
| 47 | +
|
| 48 | + - uses: actions/upload-artifact@v4 |
| 49 | + with: |
| 50 | + name: linux-build |
| 51 | + path: xlauth-linux-*.tar.gz |
| 52 | + |
| 53 | + release: |
| 54 | + needs: [ build-windows, build-linux ] |
| 55 | + runs-on: ubuntu-latest |
| 56 | + if: github.ref_type == 'tag' |
| 57 | + permissions: |
| 58 | + contents: write |
| 59 | + steps: |
| 60 | + - uses: actions/download-artifact@v4 |
| 61 | + with: |
| 62 | + name: windows-build |
| 63 | + path: dist |
| 64 | + |
| 65 | + - uses: actions/download-artifact@v4 |
| 66 | + with: |
| 67 | + name: linux-build |
| 68 | + path: dist |
| 69 | + |
| 70 | + - name: Create GitHub Release |
| 71 | + uses: softprops/action-gh-release@v2 |
| 72 | + with: |
| 73 | + files: | |
| 74 | + dist/xlauth-windows-*.zip |
| 75 | + dist/xlauth-linux-*.tar.gz |
| 76 | + name: "xlauth ${{ github.ref_name }}" |
| 77 | + body: "Automated release for ${{ github.ref_name }}" |
0 commit comments