hapistrano/.github/workflows/draft.yml

61 lines
1.8 KiB
YAML
Raw Normal View History

# The present workflow was made based on the following references:
# - https://evilmartians.com/chronicles/build-images-on-github-actions-with-docker-layer-caching
# - https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md
# - https://github.com/commercialhaskell/stack/blob/master/.github/workflows/integration-tests.yml
---
name: Draft
on:
create:
tags:
- v*
concurrency:
group: draft-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: ${{ runner.os }}-buildx-
- name: Build Docker image
uses: docker/build-push-action@v2
with:
context: .
load: true
tags: ${{ github.repository }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- name: Copy static binary
run: |
docker run \
--entrypoint cp \
--volume $PWD/bin:/root/bin \
${{ github.repository }} \
/usr/local/bin/hap \
/root/bin/hap-${{ github.ref_name }}-linux-x86_64-bin
- name: Create draft release
uses: softprops/action-gh-release@v1
with:
files: |
bin/hap-*
LICENSE
draft: true
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache