Skip to content

New dockerfile and action to publish on dockerhub #11

New dockerfile and action to publish on dockerhub

New dockerfile and action to publish on dockerhub #11

Workflow file for this run

name: Release
# Trigger the workflow on push or pull request, but only for the main branch
on:
push:
tags:
- '*'
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/amd64,linux/arm64
push: true
tags: user/app:test
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