Skip to content

Commit

Permalink
Move release jobs to separate CI workflow that triggers on manual rel…
Browse files Browse the repository at this point in the history
…ease
  • Loading branch information
Michiel-s committed Oct 17, 2021
1 parent 7256230 commit 01d63e2
Show file tree
Hide file tree
Showing 3 changed files with 216 additions and 170 deletions.
47 changes: 0 additions & 47 deletions .github/workflows/build-push-to-docker-hub.yml

This file was deleted.

124 changes: 1 addition & 123 deletions .github/workflows/ci2.yml
Original file line number Diff line number Diff line change
@@ -1,110 +1,11 @@
# Inspired by https://tech.freckle.com/2021/05/18/haskell-on-actions/
name: Build and test 🚀

on:
push:
branches:
- "**" # Only trigger on branches (i.e. not tags, ..)

jobs:

release:
name: Release 🥧
if: github.ref == 'refs/heads/master'
needs: [ build-and-test-ubuntu
, build-and-test-macOS
, build-and-test-windows
]
runs-on: ubuntu-latest
steps:
-
name: Download artifacts (Linux) 📥
uses: actions/download-artifact@v2
with:
name: Linux-binaries
path: release/Linux
-
name: get-version 🆕
run: |
chmod +x release/Linux/ampersand
echo "::set-output name=version::$(release/Linux/ampersand --numeric-version)"
echo "::set-output name=theReleaseName::$(echo "v$(release/Linux/ampersand --numeric-version) ($(date '+%_d %B %Y'))")"
id: get-version
-
name: zip the binaries (Linux) 🎒
uses: papeloto/action-zip@v1
with:
files: release/Linux/
dest: release/linux-binaries-v${{ steps.get-version.outputs.version }}.zip
-
name: Download artifacts (macOS) 📥
uses: actions/download-artifact@v2
with:
name: macOS-binaries
path: release/macOS
-
name: zip the binaries (macOS) 🎒
uses: papeloto/action-zip@v1
with:
files: release/macOS/
dest: release/macOS-binaries-v${{ steps.get-version.outputs.version }}.zip

-
name: Download artifacts (Windows) 📥
uses: actions/download-artifact@v2
with:
name: Windows-binaries
path: release/Windows
-
name: zip the binaries (Windows) 🎒
uses: papeloto/action-zip@v1
with:
files: release/Windows/
dest: release/Windows-binaries-v${{ steps.get-version.outputs.version }}.zip
-
name: Create release 🥧
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ steps.get-version.outputs.theReleaseName }}
tag_name: v${{ steps.get-version.outputs.version }}
body: |
Here you find yet another release of Ampersand. Check out the [releasenotes](https://github.com/AmpersandTarski/Ampersand/blob/development/ReleaseNotes.md) to see what has changed.
env:
GITHUB_TOKEN: ${{ github.token }}
-
name: Upload Linux artifact 📤
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ampersand-${{ steps.get-version.outputs.version }}-Linux-binaries.zip
asset_path: release/linux-binaries-v${{ steps.get-version.outputs.version }}.zip
asset_content_type: application/zip
-
name: Upload macOS artifact 📤
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ampersand-${{ steps.get-version.outputs.version }}-macOS-binaries.zip
asset_path: release/macOS-binaries-v${{ steps.get-version.outputs.version }}.zip
asset_content_type: application/zip
-
name: Upload Windows artifact 📤
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ampersand-${{ steps.get-version.outputs.version }}-Windows-binaries.zip
asset_path: release/Windows-binaries-v${{ steps.get-version.outputs.version }}.zip
asset_content_type: application/zip

build-and-test-docker:
name: Build with Docker
runs-on: ubuntu-latest
Expand Down Expand Up @@ -132,24 +33,13 @@ jobs:
-
name: Use cache when available 📦
uses: freckle/stack-cache-action@main
-
name: Archive content 🎒
uses: thedoctor0/zip-release@master
with:
filename: Ampersand.zip
-
name: Build and test 🏗 🧪
uses: freckle/stack-action@main # stack-action does all these steps: dependencies, build, test.
with:
stack-arguments: '--copy-bins --flag ampersand:buildAll'
weeder: true
hlint: true
-
name: Upload artifacts (Linux) 📤
uses: actions/upload-artifact@v2
with:
name: Linux-binaries
path: /home/runner/.local/bin/*

build-and-test-macOS:
name: Build and test on macOS 🏗 🧪
Expand All @@ -168,12 +58,6 @@ jobs:
stack-arguments: '--copy-bins --flag ampersand:buildAll'
weeder: false
hlint: true
-
name: Upload artifacts (macOS) 📤
uses: actions/upload-artifact@v2
with:
name: macOS-binaries
path: /Users/runner/.local/bin/*

build-and-test-windows:
name: Build and test on Windows 🏗 🧪
Expand All @@ -185,7 +69,7 @@ jobs:
-
name: Use cache (manually) 📦 # See https://github.com/freckle/stack-cache-action/issues/5
uses: actions/cache@v2.1.3
# TODO: Cache might be done better, see for inspiration: https://github.com/godu/advent-of-code-2020/blob/46796832f59d185457a8edf8de043a54a451d688/.github/workflows/ci.yml
# TODO: Cache might be done better, see for inspiration: https://github.com/godu/advent-of-code-2020/blob/46796832f59d185457a8edf8de043a54a451d688/.github/workflows/ci.yml
with:
path: |
~/.ghc
Expand All @@ -210,10 +94,4 @@ jobs:
stack-arguments: '--copy-bins --flag ampersand:buildAll'
weeder: false
hlint: false
-
name: Upload artifacts (Windows) 📤
uses: actions/upload-artifact@v2
with:
name: Windows-binaries
path: C:\Users\runneradmin\AppData\Roaming\local\bin\*

Loading

0 comments on commit 01d63e2

Please sign in to comment.