Skip to content

Commit

Permalink
Merge pull request #88 from geniusyield/19-release-workflow
Browse files Browse the repository at this point in the history
19 release workflow
  • Loading branch information
4TT1L4 authored Apr 6, 2023
2 parents a4cd72e + f4e3cbe commit c0754d2
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 8 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
name: Haskell CI

on: workflow_call
on:
workflow_call:
outputs:
ATLAS_VERSION:
description: "ATLAS_VERSION"
value: ${{ jobs.build.outputs.ATLAS_VERSION }}

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-22.04

outputs:
ATLAS_VERSION: ${{ steps.get_atlas_version.outputs.ATLAS_VERSION }}
steps:
- name: Checkout source code
uses: actions/checkout@v3
Expand Down Expand Up @@ -112,10 +117,12 @@ jobs:
- name: Create source distribution file (cabal)
run: cabal sdist
- name: Identify atlas version (cabal)
id: get_atlas_version
run: |
export ATLAS_VERSION=$(cabal info . | awk '{print $2 ;exit}') ;
echo "ATLAS_VERSION: $ATLAS_VERSION"
echo "ATLAS_VERSION=${ATLAS_VERSION}" >> $GITHUB_ENV
echo "ATLAS_VERSION=${ATLAS_VERSION}" >> $GITHUB_OUTPUT
- name: Generate documentation (cabal haddock)
run: cabal haddock --html --hyperlink-source --haddock-options="--use-unicode"
- name: Upload haddock documentation
Expand Down
49 changes: 44 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,50 @@ on:
- "v*"

permissions:
contents: read
contents: write

jobs:
release:
build:
uses: ./.github/workflows/haskell.yml
# TODO: Release workflow #19 (https://github.com/geniusyield/atlas/issues/19)
# - Download artifacts
# - Publish artifacts as GitHub Release
release:
runs-on: ubuntu-22.04
needs: build
steps:
- name: Checkout source code
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
name: Download source distribution file artifact
with:
name: source-distribution-file
path: ./artifacts
- uses: actions/download-artifact@v3
name: Download haddock artifact
with:
name: github-pages
path: ./artifacts
- name: Create release draft (GitHub)
env:
ATLAS_VERSION: ${{needs.build.outputs.ATLAS_VERSION}}
run: |
export GH_TOKEN=${{ secrets.GITHUB_TOKEN }}
SEMANTIC_VERSION=v${ATLAS_VERSION/#atlas-}
TAGS=$(git describe --tags)
GIT_REVISION=$(git rev-parse HEAD)
CI_BUILD_TIME=$(date --iso-8601=seconds --utc)
echo "ATLAS_VERSION: ${{ env.ATLAS_VERSION }}"
echo "SEMANTIC_VERSION: $SEMANTIC_VERSION"
echo "TAGS: $TAGS"
echo "GIT_REVISION: $GIT_REVISION"
echo "CI_BUILD_TIME: $CI_BUILD_TIME"
HADDOCK_FILE=${{ env.ATLAS_VERSION }}-haddock.tar
set -x
mv ./artifacts/artifact.tar ./artifacts/${HADDOCK_FILE}
gh release create \
--generate-notes \
--verify-tag \
--draft \
"${SEMANTIC_VERSION}" \
"./artifacts/${{ env.ATLAS_VERSION }}.tar.gz#Source distribution file (tar.gz)" \
"./artifacts/${HADDOCK_FILE}#Haddock (tar)"
echo "::notice::Succesfully created release draft ${SEMANTIC_VERSION} from ${GIT_REVISION}. (Uploaded: ${{ env.ATLAS_VERSION }}.tar.gz)"

0 comments on commit c0754d2

Please sign in to comment.