Skip to content

Commit

Permalink
Setup publish release actions
Browse files Browse the repository at this point in the history
  • Loading branch information
timbod7 committed Mar 13, 2020
1 parent 64bd175 commit e1b8784
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
${{ runner.os }}-
- name: Build and run tests
run: "cd haskell; stack build adl-compiler; stack test --fast --no-terminal adl-compiler"
run: "cd haskell; stack build --fast adl-compiler; stack test --fast --no-terminal adl-compiler"
87 changes: 87 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: New release
on:
# Fix to be on special tag
pull_request:

jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, macos-latest]
steps:
- name: Setup Stack
uses: mstksg/setup-stack@v1

- name: Clone project
uses: actions/checkout@v2
# Fetch all history so git describe works
- run: |
git fetch --prune --unshallow
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.stack
key: ${{ runner.os }}-${{ hashFiles('haskell/stack.yaml') }}
restore-keys: |
${{ runner.os }}-
- name: Build compiler and generate zip
run: "cd haskell; stack build adl-compiler; ./tools/make-dist.hs"

- name: Upload dist directory artifacts
uses: actions/upload-artifact@v1
with:
name: dist-${{ runner.os }}
path: dist

release:
name: Create Github Release
needs: [build]
runs-on: ubuntu-latest
steps:

- name: Create Release
id: create_release
uses: actions/create-release@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Fetch macOS build
uses: actions/download-artifact@v1
with:
name: dist-macOS
path: dist-macOS

- name: Fetch linux build
uses: actions/download-artifact@v1
with:
name: dist-linux
path: dist-linux

- name: Upload macOS build
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist-macOS/adl-bindist.zip
asset_name: adl-bindist-${{ github.ref }}-osx.zip
asset_content_type: application/zip

- name: Upload linux build
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist-linux/adl-bindist.zip
asset_name: adl-bindist-${{ github.ref }}-linux.zip
asset_content_type: application/zip
4 changes: 1 addition & 3 deletions haskell/tools/make-dist.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ specialFile _ = False
main = do
repoRoot <- takeDirectory <$> stackCmd "path --project-root"
localInstallRoot <- stackCmd "path --local-install-root"
version <- trim <$> readCreateProcess (shell ("git describe")) ""
platform <- (map toLower . trim) <$> readCreateProcess (shell ("uname")) ""

let zipFile = repoRoot </> "dist" </> "adl-" <> version <> "-" <> platform <> ".zip"
let zipFile = repoRoot </> "dist" </> "adl-bindist" <> ".zip"

withSystemTempDirectory "distXXXX" $ \zipDir -> do
copyFiles (localInstallRoot </> "bin") (zipDir </> "bin") (=="adlc")
Expand Down

0 comments on commit e1b8784

Please sign in to comment.