Skip to content

Commit ad12234

Browse files
authored
Merge pull request #766 from haskell-beam/github-ci-release-artifacts
Build, check, and store release artifacts
2 parents b72a870 + 8ef395b commit ad12234

File tree

3 files changed

+50
-6
lines changed

3 files changed

+50
-6
lines changed

.github/workflows/build.yaml

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
paths-ignore:
66
- 'docs/*/**'
7+
branches: [master]
78
pull_request:
89

910
jobs:
@@ -40,7 +41,7 @@ jobs:
4041
with:
4142
ghc-version: ${{ matrix.ghc-version }}
4243
cabal-version: '3.12.1.0'
43-
44+
4445
- name: Generate freeze file
4546
run: |
4647
cabal update
@@ -51,23 +52,55 @@ jobs:
5152
# avoid invalidating cache too often.
5253
# This idea comes from github.com/jaspervdj/hakyll
5354
sed '/^index-state: /d' cabal.project.freeze > dependencies-versions
54-
55+
5556
- name: Cache cabal work
5657
uses: actions/cache@v4
5758
with:
5859
path: |
5960
dist-newstyle
6061
${{ steps.setup-haskell.outputs.cabal-store }}
6162
key: ${{ runner.os }}-${{ hashFiles('dependencies-versions', 'cabal.project.local') }}-cabal-install
62-
63+
6364
- name: Build dependencies
6465
run: |
6566
cabal build all --only-dependencies ${{matrix.cabal-flags}}
66-
67+
6768
- name: Build beam packages
6869
run: |
6970
cabal build all ${{matrix.cabal-flags}}
70-
71+
7172
- name: Run tests
7273
run: |
73-
cabal test all ${{matrix.cabal-flags}}
74+
cabal test all ${{matrix.cabal-flags}}
75+
76+
release-artifacts:
77+
# Only build release artifacts if `continuous-integration` is successful
78+
needs: [continuous-integration]
79+
runs-on: ubuntu-24.04
80+
81+
steps:
82+
- uses: actions/checkout@v4
83+
84+
- name: Check packages for common mistakes
85+
run: |
86+
for pkg in $(find . -mindepth 1 -maxdepth 1 -type d -name "beam-*")
87+
do
88+
cd $pkg
89+
echo "Checking $pkg"
90+
cabal check
91+
cd $GITHUB_WORKSPACE
92+
done
93+
94+
# Note that the ubuntu-24.04 image includes cabal
95+
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#haskell-tools
96+
- name: Build release artifacts
97+
run : |
98+
cabal sdist all
99+
100+
- name: Upload build artifacts
101+
uses: actions/upload-artifact@v4
102+
if: github.ref == 'refs/heads/master'
103+
with:
104+
name: ${{ runner.os }}-release-artifact
105+
path: dist-newstyle/sdist/beam-*
106+
retention-days: 7

.github/workflows/nix-flake.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: "Nix Flake"
22
on:
33
pull_request:
44
push:
5+
branches: [master]
56
jobs:
67
nix:
78
strategy:

RELEASE-CHECKLIST.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Release checklist
2+
3+
For any given package that you want to release:
4+
5+
[ ] Update the version in the appropriate cabal file;
6+
[ ] Update the relevant CHANGELOG.md if necessary;
7+
[ ] Commit and push;
8+
[ ] Wait for the Github Actions pipeline to complete;
9+
[ ] Download the release artifacts from the build on Github Actions;
10+
[ ] Release to Hackage: `cabal upload --publish <release-artifact>`.

0 commit comments

Comments
 (0)