build #24
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
name: build | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize] | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
push: | |
description: Push to Docker hub after build is complete. | |
default: true | |
type: boolean | |
schedule: | |
- cron: '0 0 * * 6' | |
env: | |
TASK_VERSION: v3.29.1 | |
TASK_CHECKSUM: e411770abf73d5e094100ab7a1c8278f35b591ecadbfd778200b6b2ad1ee340b | |
PUSH: ${{ (inputs.push || github.event_name == 'schedule' || github.event_name == 'push') && 'true' || 'false' }} | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: sudo apt-get update | |
&& sudo apt-get install -y eatmydata | |
&& sudo ln -snf /usr/bin/eatmydata /usr/local/bin/apt-get | |
&& sudo apt-get install -y curl | |
&& curl -L -o /tmp/task_linux_amd64.deb https://github.com/go-task/task/releases/download/${{ env.TASK_VERSION }}/task_linux_amd64.deb | |
&& sha256sum /tmp/task_linux_amd64.deb | grep -q ${{ env.TASK_CHECKSUM }} | |
&& sudo dpkg -i /tmp/task_linux_amd64.deb | |
&& sudo apt-get clean | |
&& sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
- | |
# Add support for more platforms with QEMU (optional) | |
# https://github.com/docker/setup-qemu-action | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
# Expose the actions cache url and token. | |
# https://github.com/tonistiigi/go-actions-cache/blob/master/api.md#authentication | |
name: Expose GitHub Runtime | |
uses: crazy-max/ghaction-github-runtime@v2 | |
- run: task | |
id: task |