Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup publish release actions #92

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/[email protected]
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/[email protected]
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/[email protected]
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