v5.1.0 #16
Workflow file for this run
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
# This workflow triggers on a new release that is being created | |
# It build-pushes a release image to DockerHub | |
# and it attaches Linux, MacOS and Windows binary files to the release | |
name: Release | |
on: | |
release: | |
types: [created] | |
jobs: | |
add-release-notes: | |
name: Add release notes to artefacts | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Upload macOS artifact | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_name: ReleaseNotes.md | |
asset_path: ReleaseNotes.md | |
asset_content_type: text/markdown | |
docker-hub: | |
name: Build push image to DockerHub | |
runs-on: ubuntu-latest | |
steps: | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
ampersandtarski/ampersand | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern=v{{version}} | |
type=semver,pattern=v{{major}}.{{minor}} | |
type=semver,pattern=v{{major}} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Build and push to Docker Hub | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} # see meta step above | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
GIT_SHA=${{github.sha}} | |
GIT_Branch=${{github.ref}} | |
add-release-artefacts: | |
name: Add artefacts to release | |
needs: [build-without-test-ubuntu, build-without-test-macOS] | |
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 "version=$(release/Linux/ampersand --numeric-version)" >> $GITHUB_OUTPUT | |
echo "theReleaseName=$(echo "v$(release/Linux/ampersand --numeric-version) ($(date '+%_d %B %Y'))")" >> $GITHUB_OUTPUT | |
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: Upload Linux artifact | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ github.event.release.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: ${{ github.event.release.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: ${{ github.event.release.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-without-test-ubuntu: | |
name: Build without test on ubuntu-latest 🏗 🧪 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project contents 📡 | |
uses: actions/checkout@v3 | |
- name: Set up Mariadb 🧰 | |
uses: shogo82148/actions-setup-mysql@v1 | |
with: | |
mysql-version: "mariadb-10.6" | |
- name: build without test 🏗 🧪 | |
uses: freckle/stack-action@v5 # stack-action does all these steps: dependencies, build, test. | |
with: | |
stack-build-arguments: "--copy-bins --flag ampersand:buildAll" | |
upgrade-stack: false | |
test: false | |
- name: Upload artifacts (Linux) | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Linux-binaries | |
path: /home/runner/.local/bin/* | |
build-without-test-macOS: | |
name: Build without test on macOS 🏗 🧪 | |
runs-on: macos-latest | |
steps: | |
- name: Checkout project contents 📡 | |
uses: actions/checkout@v3 | |
- name: Set up Mariadb 🧰 | |
uses: shogo82148/actions-setup-mysql@v1 | |
with: | |
mysql-version: "mariadb-10.6" | |
# See issue https://github.com/freckle/stack-action/issues/80 for why we need to install stack and php as well | |
- run: curl -sSL https://get.haskellstack.org/ | sh | |
- run: brew install php | |
- name: Build without test 🏗 🧪 | |
uses: freckle/stack-action@v5 | |
with: | |
stack-build-arguments: "--copy-bins --flag ampersand:buildAll" | |
upgrade-stack: false | |
test: false | |
- name: Upload artifacts (macOS) | |
uses: actions/upload-artifact@v2 | |
with: | |
name: macOS-binaries | |
path: /Users/runner/.local/bin/* | |
# build-without-test-windows: | |
# name: build without test on Windows 🏗 🧪 | |
# runs-on: windows-latest | |
# steps: | |
# - name: Checkout project contents 📡 | |
# uses: actions/checkout@v3 | |
# # - name: Use cache (manually) 📦 # See https://github.com/freckle/stack-cache-action/issues/5 | |
# # uses: actions/[email protected] | |
# # # 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 | |
# # ~/.stack | |
# # ~/.stack-work | |
# # key: ${{ runner.os }}-stack | |
# - name: Set up Mariadb 🧰 | |
# uses: shogo82148/actions-setup-mysql@v1 | |
# with: | |
# mysql-version: "mariadb-10.6" | |
# - name: Setup PHP 🧰 | |
# uses: shivammathur/setup-php@v2 | |
# with: | |
# php-version: "8.0" | |
# extensions: mysqli | |
# - name: build without test 🏗 🧪 | |
# uses: freckle/stack-action@v5 | |
# with: | |
# stack-build-arguments: "--copy-bins --flag ampersand:buildAll" | |
# test: false | |
# - name: Upload artifacts (Windows) | |
# uses: actions/upload-artifact@v2 | |
# with: | |
# name: Windows-binaries | |
# path: C:\Users\runneradmin\AppData\Roaming\local\bin\* |