Auto-Build #3
This file contains 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
on: | |
workflow_dispatch: | |
name: Auto-Build | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
architecture: [amd64, arm64, armv7] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Build container for ${{ matrix.architecture }} | |
run: | | |
docker build -t builder --build-arg TARGET_ARCH=${{ matrix.architecture }} . | |
- run: git clone --depth=1 --branch mosh-1.3.2 https://github.com/mobile-shell/mosh.git | |
- name: Build binaries for ${{ matrix.architecture }} | |
run: docker run -v $PWD/mosh:/mosh -w /mosh --name=builder builder sh -c './autogen.sh && LDFLAGS=-static ./configure && make' | |
- name: Test run mosh-server | |
run: docker run -v $PWD/mosh:/mosh -w /mosh/src/frontend builder sh -c 'chmod +x mosh-server && ./mosh-server' | |
- name: Rename binaries | |
run: | | |
mv mosh/src/frontend/mosh-server mosh/src/frontend/mosh-server-linux-${{ matrix.architecture }} | |
mv mosh/src/frontend/mosh-client mosh/src/frontend/mosh-client-linux-${{ matrix.architecture }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: mosh-server-linux-${{ matrix.architecture }} | |
path: mosh/src/frontend/mosh-server-linux-${{ matrix.architecture }} | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: mosh-client-linux-${{ matrix.architecture }} | |
path: mosh/src/frontend/mosh-client-linux-${{ matrix.architecture }} | |
if-no-files-found: error | |
release: | |
name: Release | |
needs: [build] | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
- name: Create release description | |
run: | | |
( | |
echo '- [Build #${{ github.run_number }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})' | |
echo '- [Workflow file](https://github.com/${{ github.repository }}/blob/${{ github.sha }}/.github/workflows/autobuild.yml)' | |
echo | |
echo '## Files' | |
echo '```' | |
(file mosh-client-*/mosh-client* mosh-server-*/mosh-server*) | |
echo '```' | |
echo | |
echo '## SHA256 Checksums' | |
echo '```' | |
(sha256sum mosh-client-*/mosh-client* mosh-server-*/mosh-server*) | |
echo '```' | |
) | tee release.md | |
- id: upload_artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: release.md | |
path: release.md | |
if-no-files-found: error | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: "Build #${{ github.run_number }}" | |
tag_name: run-${{ github.run_number }} | |
prerelease: false | |
draft: false | |
body_path: release.md | |
files: | | |
mosh-client-*/mosh-client* | |
mosh-server-*/mosh-server* | |