Skip to content

Commit

Permalink
Use cabal to release
Browse files Browse the repository at this point in the history
  • Loading branch information
diogob committed Nov 11, 2023
1 parent 3a69ae1 commit 08abd66
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 37 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- uses: actions/checkout@v4

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

Expand Down Expand Up @@ -61,4 +61,4 @@ jobs:
with:
name: Store binaries
path: |
dist-newstyle/**/postgres-websockets
dist-newstyle/build/**/postgres-websockets/postgres-websockets
47 changes: 12 additions & 35 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,13 @@ on:
- '*'

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/arm64
push: true
tags: user/app:test
stack:
name: stack / ${{ matrix.os }} / ghc ${{ matrix.ghc }}
build:
name: release / ${{ matrix.os }} / ghc ${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
stack: ["2.5.1"]
ghc: ["8.10.4"]
ghc: ["9.6.3"]

services:
postgres:
Expand All @@ -52,23 +30,22 @@ jobs:
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

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

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

- name: Build
run: |
stack build --system-ghc
cabal build
- name: Download ghr
run: |
Expand All @@ -78,11 +55,11 @@ jobs:
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
run: sha256sum `find dist-newstyle -executable -type f -name postgres-websockets` > dist-newstyle/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/
cp dist-newstyle/postgres-websockets.sha256 `find dist-newstyle -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 08abd66

Please sign in to comment.