Fix CI: add ssh-agent for private git dependencies #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| name: Build (${{ matrix.target }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| artifact: jcode-linux-x86_64 | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| artifact: jcode-macos-aarch64 | |
| - os: macos-13 | |
| target: x86_64-apple-darwin | |
| artifact: jcode-macos-x86_64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ssh-key: ${{ secrets.DEPLOY_KEY }} | |
| submodules: recursive | |
| - name: Configure SSH for cargo git dependencies | |
| uses: webfactory/ssh-agent@v0.9.0 | |
| with: | |
| ssh-private-key: ${{ secrets.DEPLOY_KEY }} | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ matrix.target }} | |
| - name: Build release binary | |
| run: | | |
| mkdir -p .cargo | |
| echo -e '[build]\nrustc-wrapper = ""' > .cargo/config.toml | |
| cargo build --release --target ${{ matrix.target }} | |
| env: | |
| JCODE_RELEASE_BUILD: "1" | |
| - name: Package binary | |
| run: | | |
| mkdir -p dist | |
| cp target/${{ matrix.target }}/release/jcode dist/${{ matrix.artifact }} | |
| chmod +x dist/${{ matrix.artifact }} | |
| cd dist && tar czf ${{ matrix.artifact }}.tar.gz ${{ matrix.artifact }} | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: dist/${{ matrix.artifact }}.tar.gz | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| files: artifacts/**/*.tar.gz |