Skip to content

Commit

Permalink
Merge pull request #23 from brandonchinn178/ci
Browse files Browse the repository at this point in the history
Update CI + release 0.2.0.0
  • Loading branch information
brandonchinn178 committed Nov 11, 2022
2 parents f9ea089 + badc16d commit dc6e4f8
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 188 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
STACK_YAML: ${{ matrix.stack_yaml }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install toml-test
env:
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
env:
FOURMOLU_VERSION: '0.7.0.1'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install fourmolu
run: |
Expand All @@ -76,13 +76,18 @@ jobs:
check_sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.stack
key: ${{ runner.os }}-check_sdist-${{ hashFiles('stack.yaml') }}

- name: Strip unreleased section from CHANGELOG
run: sed -i -n '/^## Unreleased/d; /^## /,$p' CHANGELOG.md

- name: Create sdist bundle
run: stack sdist --test-tarball --tar-dir .

- uses: actions/upload-artifact@v3
with:
name: toml-reader-sdist
Expand Down
47 changes: 30 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- ci

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: main

Expand All @@ -20,23 +20,36 @@ jobs:
name: toml-reader-sdist
path: ./sdist/

- name: Load package version
run: scripts/GetVersion.hs
id: version_info
- uses: brandonchinn178/haskell-actions/parse-cabal-file@parse-cabal-file
id: cabal_file
with:
cabal_file: toml-reader.cabal
- name: Set version label
run: echo 'VERSION=v${{ steps.cabal_file.outputs.version }}' >> "${GITHUB_ENV}"

- name: Load Hackage token secret name
run: |
import re
username = "${{ github.actor }}"
secret_name = "HACKAGE_TOKEN_" + re.sub(r"\W+", "_", username).upper()
print(f"::set-output name=secret_name::{secret_name}")
shell: python
id: hackage_token_secret
run: |
USERNAME="$(echo "${GITHUB_ACTOR}" | tr '[:lower:]' '[:upper:]' | tr '-' '_')"
echo "name=HACKAGE_TOKEN_${USERNAME}" >> "${GITHUB_OUTPUT}"
- name: Get CHANGELOG section
run: |
sed '/^## Unreleased/,/^$/d' CHANGELOG.md > /tmp/changelog-without-unreleased
if [[ "$(head -n 1 /tmp/changelog-without-unreleased)" != "## ${VERSION}" ]]; then
echo "CHANGELOG doesn't look updated" >&2
exit 1
fi
sed '1 d; /^## v/,$ d' /tmp/changelog-without-unreleased > /tmp/changelog-body
- uses: brandonchinn178/haskell-actions/hackage-upload@hackage-upload
with:
archive: sdist/toml-reader-*.tar.gz
token: ${{ secrets[steps.hackage_token_secret.outputs.name] }}

- name: Make release
run: scripts/make-release.sh
env:
gh_token: ${{ secrets.GITHUB_TOKEN }}
hackage_token: ${{ secrets[steps.hackage_token_secret.outputs.secret_name] }}
version: ${{ steps.version_info.outputs.version }}
sdistdir: ./sdist/
- uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION }}
body_path: /tmp/changelog-body
draft: true
target_commitish: ${{ github.sha }}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Unreleased

## v0.2.0.0

* Add getFieldOr [#10](https://github.com/brandonchinn178/toml-reader/issues/10)
* Handle extremely large float values [#8](https://github.com/brandonchinn178/toml-reader/issues/8)
* Add Exception instance for TOMLError
Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: toml-reader
version: 0.1.0.0
version: 0.2.0.0
category: TOML, Text, Configuration
synopsis: TOML format parser compliant with v1.0.0.
description: TOML format parser compliant with v1.0.0. See README.md for more details.
Expand Down
1 change: 0 additions & 1 deletion scripts/.gitignore

This file was deleted.

21 changes: 0 additions & 21 deletions scripts/GetVersion.hs

This file was deleted.

11 changes: 0 additions & 11 deletions scripts/make-release.sh

This file was deleted.

133 changes: 0 additions & 133 deletions scripts/make_release.py

This file was deleted.

2 changes: 1 addition & 1 deletion toml-reader.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack

name: toml-reader
version: 0.1.0.0
version: 0.2.0.0
synopsis: TOML format parser compliant with v1.0.0.
description: TOML format parser compliant with v1.0.0. See README.md for more details.
category: TOML, Text, Configuration
Expand Down

0 comments on commit dc6e4f8

Please sign in to comment.