name: Build and Release on: push: tags: - 'v*' jobs: build-linux: name: Build Linux runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Rust uses: actions/setup-rust@v1 with: rust-version: stable - name: Build run: cargo build --release - name: Package Linux run: | mkdir -p dist-linux cp target/release/dhl dist-linux/dhl cp config.json.example dist-linux/config.json cp response.json.example dist-linux/response.json tar -czvf dhl-linux.tar.gz -C dist-linux . - name: Upload Linux Artifact uses: actions/upload-artifact@v4 with: name: dhl-linux path: dhl-linux.tar.gz build-windows: name: Build Windows runs-on: windows-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Rust uses: actions/setup-rust@v1 with: rust-version: stable - name: Build run: cargo build --release - name: Package Windows shell: pwsh run: | New-Item -ItemType Directory -Force -Path dist-windows Copy-Item target/release/dhl.exe dist-windows/dhl.exe Copy-Item config.json.example dist-windows/config.json Copy-Item response.json.example dist-windows/response.json Compress-Archive -Path dist-windows/* -DestinationPath dhl-windows.zip - name: Upload Windows Artifact uses: actions/upload-artifact@v4 with: name: dhl-windows path: dhl-windows.zip create-release: name: Create Release needs: [build-linux, build-windows] runs-on: ubuntu-latest steps: - name: Download Linux Artifact uses: actions/download-artifact@v4 with: name: dhl-linux path: . - name: Download Windows Artifact uses: actions/download-artifact@v4 with: name: dhl-windows path: . - name: Create Gitea Release uses: softprops/action-gh-release@v2 with: files: | dhl-linux.tar.gz dhl-windows.zip name: Release ${{ github.ref_name }} tag_name: ${{ github.ref }} generate_release_notes: true draft: false prerelease: false env: # Gitea uses "GITHUB_TOKEN" for compatibility, but it is your Gitea token. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This ensures the action uses your Gitea API instead of GitHub. GITHUB_API_URL: ${{ github.api_url }}