From df388904a79a8e68bb7c273eba495a2e32c0c6a3 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Sat, 9 Sep 2023 21:10:46 -0500 Subject: [PATCH] Add workflow --- .github/workflows/main.yml | 89 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..e0f29fa3 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,89 @@ +name: main + +on: + workflow_dispatch: + push: + tags: + - "*" + +jobs: + create_release: + name: Create release + runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + steps: + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: false + prerelease: false + build_linux: + name: "linux build: ${{ matrix.arch }}" + runs-on: ubuntu-20.04 # use older version on purpose for GLIBC + needs: create_release # we need to know the upload URL + strategy: + fail-fast: true + matrix: + arch: [x64, aarch64, armv7] + steps: + - uses: actions/checkout@v3 + - name: configure + run: | + cmake -Bbuild -DCMAKE_INSTALL_PREFIX=_install/piper + - name: build + run: | + cmake --build build --config Release + - name: install + run: | + cmake --install build + - name: package + run: | + cd _install && \ + tar -czf piper_linux_${{ matrix.arch }}.tar.gz piper/ + - name: upload + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: _install/piper_linux_${{ matrix.arch }}.tar.gz + asset_name: piper_linux_${{ matrix.arch }}.tar.gz + asset_content_type: application/octet-stream + build_windows: + runs-on: windows-latest + name: "windows build: ${{ matrix.arch }}" + needs: create_release # we need to know the upload URL + strategy: + fail-fast: true + matrix: + arch: [x64] + steps: + - uses: actions/checkout@v3 + - name: configure + run: | + cmake -Bbuild -DCMAKE_INSTALL_PREFIX=_install/piper + - name: build + run: | + cmake --build build --config Release + - name: install + run: | + cmake --install build + - name: package + run: | + cd _install + Compress-Archive -LiteralPath piper -DestinationPath piper_windows_amd64.zip + - name: upload + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: _install/piper_windows_amd64.zip + asset_name: piper_windows_amd64.zip + asset_content_type: application/zip