From ae4833bca92fa56c8be619aed18a83040c2cf55f Mon Sep 17 00:00:00 2001 From: Joe Hermaszewski Date: Tue, 8 Dec 2020 12:54:32 +0800 Subject: [PATCH 1/4] Add tag-release action --- .github/workflows/tag-release.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/tag-release.yml diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml new file mode 100644 index 0000000..1840235 --- /dev/null +++ b/.github/workflows/tag-release.yml @@ -0,0 +1,19 @@ +name: Tag Latest Release + +on: + push: + branches: + - master + +jobs: + update: + runs-on: ubuntu-20.04 + steps: + - uses: cachix/install-nix-action@v12 + with: + nix_path: nixpkgs=channel:nixos-unstable + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Fetch everything + ssh-key: ${{ secrets.DEPLOY_KEY }} + - uses: expipiplus1/tag-latest-release/tag-latest-release@HEAD From 82172f844a729ee90ca051bc3001f489cf8a7321 Mon Sep 17 00:00:00 2001 From: Joe Hermaszewski Date: Tue, 8 Dec 2020 13:02:56 +0800 Subject: [PATCH 2/4] Add release.nix to generate tarballs for Hackage --- .github/workflows/ci.yml | 3 +++ release.nix | 10 ++++++++++ 2 files changed, 13 insertions(+) create mode 100644 release.nix diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e325a6a..d34fb98 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,3 +99,6 @@ jobs: nix_path: nixpkgs=channel:nixos-unstable - uses: actions/checkout@v2 - run: nix-build + - run: nix-build release.nix -A tarball + - run: nix-build release.nix -A sdistTest + - run: nix-build release.nix -A docs diff --git a/release.nix b/release.nix new file mode 100644 index 0000000..c1686ec --- /dev/null +++ b/release.nix @@ -0,0 +1,10 @@ +{ pkgs ? import { }, compiler ? null }: + +with pkgs.haskell.lib; + +let drv = import ./default.nix { inherit pkgs compiler; }; +in { + tarball = sdistTarball drv; + docs = documentationTarball drv; + sdistTest = buildFromSdist drv; +} From f523bd1358cdc67da3795436b68d85de3dca5f19 Mon Sep 17 00:00:00 2001 From: Joe Hermaszewski Date: Tue, 8 Dec 2020 13:03:15 +0800 Subject: [PATCH 3/4] Add package.yaml to tarball; --- package.yaml | 1 + vector-sized.cabal | 1 + 2 files changed, 2 insertions(+) diff --git a/package.yaml b/package.yaml index 862ffd6..2b9b121 100644 --- a/package.yaml +++ b/package.yaml @@ -10,6 +10,7 @@ license: BSD3 github: expipiplus1/vector-sized extra-source-files: +- package.yaml - readme.md - changelog.md - default.nix diff --git a/vector-sized.cabal b/vector-sized.cabal index c93f6a2..c559bf4 100644 --- a/vector-sized.cabal +++ b/vector-sized.cabal @@ -18,6 +18,7 @@ license: BSD3 license-file: LICENSE build-type: Simple extra-source-files: + package.yaml readme.md changelog.md default.nix From 82d96c2e882e51b144e8aee86eb52f415e664886 Mon Sep 17 00:00:00 2001 From: Joe Hermaszewski Date: Tue, 8 Dec 2020 13:04:48 +0800 Subject: [PATCH 4/4] Add create release action --- .github/workflows/release.yml | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d1980ce --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Create Release + +on: + push: + tags: + - v* + +jobs: + build: + name: Create Release + runs-on: ubuntu-20.04 + steps: + - uses: cachix/install-nix-action@v12 + with: + nix_path: nixpkgs=channel:nixos-unstable + - uses: actions/checkout@v2 + + - name: Build project + run: | + mkdir assets + nix-build ./release.nix -A sdistTest --no-out-link + ln -s "$(nix-build release.nix -A tarball --no-out-link)"/*.tar.gz assets/ + ln -s "$(nix-build release.nix -A docs --no-out-link)"/*.tar.gz assets/ + ref="${{ github.ref }}" + printf "Release ${ref#"refs/tags/"}\n\n" >release-note.md + # Get the section after the WIP section + awk '/## WIP/{flag=0;next};/##/{flag=flag+1};flag==1' >"release-note.md" + + - name: Create Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if [ -f release-note.md ]; then + hub release create \ + $(find assets -type f -o -type l -printf "--attach %p ") \ + --file release-note.md \ + ${{ github.ref }} + fi