Release #4
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 | |
on: workflow_dispatch | |
jobs: | |
ci: | |
uses: ./.github/workflows/ci.yml | |
release: | |
runs-on: ubuntu-latest | |
needs: | |
- ci | |
steps: | |
- | |
uses: actions/checkout@v3 | |
- | |
uses: actions/download-artifact@v3 | |
with: | |
name: graphql-client-sdist | |
path: ./sdist/ | |
- | |
uses: haskell-actions/parse-cabal-file@v1 | |
id: cabal_file | |
with: | |
cabal_file: graphql-client/graphql-client.cabal | |
- | |
name: Set version label | |
run: echo 'VERSION=v${{ steps.cabal_file.outputs.version }}' >> "${GITHUB_ENV}" | |
- | |
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 | |
- | |
id: hackage_token_secret | |
name: Load Hackage token secret name | |
run: | | |
USERNAME="$(echo "${GITHUB_ACTOR}" | tr '[:lower:]' '[:upper:]' | tr '-' '_')" | |
echo "name=HACKAGE_TOKEN_${USERNAME}" >> "${GITHUB_OUTPUT}" | |
- | |
uses: haskell-actions/hackage-publish@v1 | |
with: | |
hackageToken: ${{ secrets[steps.hackage_token_secret.outputs.name] }} | |
packagesPath: ./sdist/ | |
- | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.VERSION }} | |
body_path: /tmp/changelog-body | |
draft: true | |
target_commitish: ${{ github.sha }} |