Skip to content

Commit

Permalink
Write new workflow to publish release files
Browse files Browse the repository at this point in the history
  • Loading branch information
diogob committed Jun 17, 2021
1 parent 8145388 commit 9d24940
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Release

# Trigger the workflow on push or pull request, but only for the main branch
on:
push:
tags:
- '*'

jobs:
stack:
name: stack / ${{ matrix.os }} / ghc ${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
stack: ["2.5.1"]
ghc: ["8.10.4"]

services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: roottoor
POSTGRES_USER: postgres
POSTGRES_DB: postgres_ws_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2

- uses: haskell/actions/setup@v1
name: Setup Haskell Stack
with:
ghc-version: ${{ matrix.ghc }}
stack-version: ${{ matrix.stack }}

- uses: actions/[email protected]
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ matrix.os }}-${{ matrix.ghc }}-stack-v3

- name: Build
run: |
stack build --system-ghc
- name: Download ghr
run: |
curl -sSLO https://github.com/tcnksm/ghr/releases/download/v0.14.0/ghr_v0.14.0_linux_amd64.tar.gz
curl -sSLO https://github.com/tcnksm/ghr/releases/download/v0.14.0/v0.14.0_SHASUMS
sha256sum --check --ignore-missing v0.14.0_SHASUMS
tar --strip-components=1 -zxvf ghr_v0.14.0_linux_amd64.tar.gz ghr_v0.14.0_linux_amd64/ghr
- name: Calculate and save checksum
run: sha256sum `find .stack-work/dist -executable -type f -name postgres-websockets` > .stack-work/dist/postgres-websockets.sha256

- name: Publish Release on GitHub
run: |
mkdir ./release
cp .stack-work/dist/postgres-websockets.sha256 `find .stack-work/dist -executable -type f -name postgres-websockets` ./release/
VERSION=$(awk '/^version: / { print $2 };' < postgres-websockets.cabal)
./ghr -t ${{ secrets.GITHUB_TOKEN }} ${VERSION} ./release

0 comments on commit 9d24940

Please sign in to comment.