Skip to content

Commit

Permalink
Update workflow file to support multiple architectures
Browse files Browse the repository at this point in the history
  • Loading branch information
freitas-renato committed Oct 27, 2023
1 parent b40ceee commit 0f97382
Showing 1 changed file with 59 additions and 32 deletions.
91 changes: 59 additions & 32 deletions .github/workflows/autobuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,60 +5,87 @@ jobs:
build:
name: Build
runs-on: ubuntu-20.04

strategy:
matrix:
architecture: [amd64]

steps:
- name: Checkout code
uses: actions/checkout@v2
- run: docker build -t builder .
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
- run: docker run -v $PWD/mosh:/mosh -w /mosh --name=builder builder sh -c './autogen.sh && LDFLAGS=-static ./configure && make'
- uses: actions/upload-artifact@v2

- 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'

- uses: actions/upload-artifact@v3
with:
name: mosh-server
name: mosh-server-${{ matrix.architecture }}
path: mosh/src/frontend/mosh-server
if-no-files-found: error
- uses: actions/upload-artifact@v2

- uses: actions/upload-artifact@v3
with:
name: mosh-client
name: mosh-client-${{ matrix.architecture }}
path: mosh/src/frontend/mosh-client
if-no-files-found: error
- run: |

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 '```'
(cd mosh/src/frontend && file mosh-server mosh-client)
(file mosh-client-*/mosh-client mosh-server-*/mosh-server)
echo '```'
echo
echo '## SHA256 Checksums'
echo '```'
(cd mosh/src/frontend && sha256sum mosh-server mosh-client)
(sha256sum mosh-client-*/mosh-client mosh-server-*/mosh-server)
echo '```'
) | tee release.md
- id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: upload_artifact
uses: actions/upload-artifact@v3
with:
name: release.md
path: release.md
if-no-files-found: error

- run: |
for i in mosh-client-*/; do zip -r "${i%/}.zip" "$i"; done
- run: |
for i in mosh-server-*/; do zip -r "${i%/}.zip" $i; done
- name: Create release
uses: softprops/action-gh-release@v1
with:
name: "Build #${{ github.run_number }}"
tag_name: run-${{ github.run_number }}
release_name: "Build #${{ github.run_number }}"
body_path: release.md
prerelease: false
draft: false
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mosh/src/frontend/mosh-client
asset_name: mosh-client
asset_content_type: application/octet-stream
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mosh/src/frontend/mosh-server
asset_name: mosh-server
asset_content_type: application/octet-stream
body_path: release.md
files: |
*.zip

0 comments on commit 0f97382

Please sign in to comment.