diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml new file mode 100644 index 0000000..3447bb6 --- /dev/null +++ b/.github/workflows/build-binaries.yml @@ -0,0 +1,80 @@ +name: Generate VIPBundle binary + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + ubuntu_20_04_build: + + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + - uses: haskell/actions/setup@v1 + with: + ghc-version: '9.2.1' + #cabal-version: '3.2' + + - name: Cache + uses: actions/cache@v3 + env: + cache-name: cache-cabal + with: + path: ~/.cabal + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Install dependencies + run: | + cabal update + cabal build --only-dependencies + - name: Build + run: | + cabal build + cp `cabal list-bin vipbundle` vipbundle + - name: Upload artifact + uses: actions/upload-artifact@master + with: + name: vipbundle + path: vipbundle + + release: + needs: ubuntu_20_04_build + runs-on: [ubuntu-latest] + steps: + - name: Download artifact + uses: actions/download-artifact@master + with: + name: vipbundle + path: ./ + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y%m%d')" + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: build-${{ steps.date.outputs.date }}-${{ github.sha }} + release_name: Build ${{ steps.date.outputs.date }} + body: Latest snapshot (${{ github.sha }}) + prerelease: true + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: ./vipbundle + asset_name: vipbundle-snapshot-${{ github.sha }}