|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +env: |
| 9 | + CARGO_TERM_COLOR: always |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + name: Build ${{ matrix.target }} |
| 14 | + runs-on: ubuntu-latest |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + include: |
| 18 | + - target: x86_64-unknown-linux-gnu |
| 19 | + - target: x86_64-unknown-linux-musl |
| 20 | + - target: aarch64-unknown-linux-gnu |
| 21 | + - target: aarch64-unknown-linux-musl |
| 22 | + |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - name: Install Rust |
| 27 | + uses: dtolnay/rust-toolchain@stable |
| 28 | + with: |
| 29 | + targets: ${{ matrix.target }} |
| 30 | + |
| 31 | + - name: Install cross |
| 32 | + run: cargo install cross --git https://github.com/cross-rs/cross |
| 33 | + |
| 34 | + - name: Build |
| 35 | + run: cross build --release --target ${{ matrix.target }} |
| 36 | + |
| 37 | + - name: Package |
| 38 | + run: | |
| 39 | + mkdir -p dist |
| 40 | + cp target/${{ matrix.target }}/release/fakenotifyd dist/fakenotifyd-${{ matrix.target }} |
| 41 | + cp target/${{ matrix.target }}/release/libfakenotify_preload.so dist/libfakenotify_preload-${{ matrix.target }}.so |
| 42 | +
|
| 43 | + - name: Upload artifacts |
| 44 | + uses: actions/upload-artifact@v4 |
| 45 | + with: |
| 46 | + name: binaries-${{ matrix.target }} |
| 47 | + path: dist/ |
| 48 | + |
| 49 | + release: |
| 50 | + name: Create Release |
| 51 | + needs: build |
| 52 | + runs-on: ubuntu-latest |
| 53 | + permissions: |
| 54 | + contents: write |
| 55 | + |
| 56 | + steps: |
| 57 | + - uses: actions/checkout@v4 |
| 58 | + |
| 59 | + - name: Download all artifacts |
| 60 | + uses: actions/download-artifact@v4 |
| 61 | + with: |
| 62 | + path: artifacts |
| 63 | + |
| 64 | + - name: Prepare release files |
| 65 | + run: | |
| 66 | + mkdir -p release |
| 67 | +
|
| 68 | + # Copy all binaries |
| 69 | + find artifacts -type f -exec cp {} release/ \; |
| 70 | +
|
| 71 | + # Create convenience copies for "latest" (x86_64 musl = most portable) |
| 72 | + cp release/fakenotifyd-x86_64-unknown-linux-musl release/fakenotifyd |
| 73 | + cp release/libfakenotify_preload-x86_64-unknown-linux-musl.so release/libfakenotify_preload.so |
| 74 | +
|
| 75 | + ls -la release/ |
| 76 | +
|
| 77 | + - name: Create Release |
| 78 | + uses: softprops/action-gh-release@v2 |
| 79 | + with: |
| 80 | + files: release/* |
| 81 | + generate_release_notes: true |
| 82 | + |
| 83 | + docker: |
| 84 | + name: Build Docker Images |
| 85 | + needs: build |
| 86 | + runs-on: ubuntu-latest |
| 87 | + permissions: |
| 88 | + contents: read |
| 89 | + packages: write |
| 90 | + |
| 91 | + steps: |
| 92 | + - uses: actions/checkout@v4 |
| 93 | + |
| 94 | + - name: Download artifacts |
| 95 | + uses: actions/download-artifact@v4 |
| 96 | + with: |
| 97 | + name: binaries-x86_64-unknown-linux-musl |
| 98 | + path: dist |
| 99 | + |
| 100 | + - name: Set up Docker Buildx |
| 101 | + uses: docker/setup-buildx-action@v3 |
| 102 | + |
| 103 | + - name: Login to GHCR |
| 104 | + uses: docker/login-action@v3 |
| 105 | + with: |
| 106 | + registry: ghcr.io |
| 107 | + username: ${{ github.actor }} |
| 108 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 109 | + |
| 110 | + - name: Extract version |
| 111 | + id: version |
| 112 | + run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT |
| 113 | + |
| 114 | + - name: Build and push daemon |
| 115 | + uses: docker/build-push-action@v6 |
| 116 | + with: |
| 117 | + context: . |
| 118 | + file: Dockerfile.release |
| 119 | + push: true |
| 120 | + tags: | |
| 121 | + ghcr.io/${{ github.repository_owner }}/fakenotify:${{ steps.version.outputs.version }} |
| 122 | + ghcr.io/${{ github.repository_owner }}/fakenotify:latest |
| 123 | +
|
| 124 | + - name: Build and push DockerMod |
| 125 | + uses: docker/build-push-action@v6 |
| 126 | + with: |
| 127 | + context: ./docker-mods |
| 128 | + push: true |
| 129 | + tags: | |
| 130 | + ghcr.io/${{ github.repository_owner }}/fakenotify-mod:${{ steps.version.outputs.version }} |
| 131 | + ghcr.io/${{ github.repository_owner }}/fakenotify-mod:latest |
0 commit comments