Skip to content

Improve restyled.yaml.5 #441

Improve restyled.yaml.5

Improve restyled.yaml.5 #441

Workflow file for this run

name: CI
on:
pull_request:
push:
branches: main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
os: [linux]
include:
- os: linux
runner: ubuntu-latest
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- id: stack
uses: freckle/stack-action@v5
- uses: freckle/weeder-action@v2
with:
ghc-version: ${{ steps.stack.outputs.compiler-version }}
- run: |
dist=restyler-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m)
mkdir -p "$dist"
cp -v ${{ steps.stack.outputs.local-install-root }}/bin/* "$dist"
tar czf "$dist.tar.gz" "$dist"
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-binaries
path: "restyler-*.tar.gz"
if-no-files-found: error
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/hlint-setup@v2
- uses: haskell-actions/hlint-run@v2
with:
fail-on: warning
prerelease:
# Comment this to update a pre-release from your PR
if: ${{ false }}
env:
RC_TAG: v0.4.0.0-rc
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.RC_TAG }}
generate_release_notes: true
files: "*-binaries/restyler-*.tar.gz"
fail_on_unmatched_files: true
integration-test:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/download-artifact@v4
with:
name: linux-binaries
- run: |
tar xzf restyler-*.tar.gz
mkdir -p ./bin
sudo mv -v restyler-*/restyle /usr/local/bin
restyle --help
- uses: restyled-io/actions/setup-demo@v2
with:
options: --limit 3
- uses: restyled-io/actions/run@v2
with:
paths: .
log-level: debug
release:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v4
- id: tag
uses: freckle/haskell-tag-action@v1
- if: steps.tag.outputs.tag
uses: actions/download-artifact@v4
- if: steps.tag.outputs.tag
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.tag }}
generate_release_notes: true
files: "*-binaries/restyler-*.tar.gz"
fail_on_unmatched_files: true
docs:
#if: ${{ github.ref == 'refs/heads/main' }}
needs: [build]
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
contents: read
pages: write
id-token: write
runs-on: ubuntu-latest
steps:
- run: echo "$HOME/.local/share/gem/ruby/3.0.0/bin" >>"$GITHUB_PATH"
- run: gem install --user ronn-ng
- uses: actions/download-artifact@v4
with:
name: linux-binaries
- run: |
tar xzf restyler-*.tar.gz
mkdir -p ./bin
sudo mv -v restyler-*/restyle /usr/local/bin
# TODO: only checkout doc folder
- uses: actions/checkout@v4
- name: Generate ronn documenation
run: |
restyle __render-docs-man1__ > doc/restyle.1.ronn
restyle __render-docs-man5__ > doc/restyled.yaml.5.ronn
- name: Generate HTML sources to _site
run: |
env \
RONN_STYLE=./doc \
RONN_ORGANIZATION=Restyled \
RONN_MANUAL="Restyler v$(restyle --version | cut -d' ' -f 2)" \
ronn --style toc,custom --roff --html doc/*.ronn
mkdir -p _site/man-pages
cp -v doc/*.html _site/man-pages/
- uses: actions/configure-pages@v3
- uses: actions/upload-pages-artifact@v1
with:
path: _site
- id: deployment
uses: actions/deploy-pages@v1
test-install:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ./install
- run: restyle --help