Testing build only on arm64 #12
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/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 |