Publish #7
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
# | |
# Generated by @zondax/cli | |
# | |
name: Publish | |
on: | |
push: | |
branches: | |
- main | |
- master | |
- dev | |
pull_request: | |
branches: ["*"] | |
release: | |
types: | |
- created | |
tags: | |
- "v[0-9]+" | |
- "v[0-9]+.[0-9]+" | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
build: | |
runs-on: zondax-runners | |
steps: | |
- name: Install deps | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -yy git make | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # get everything | |
- name: Put back the git branch into git (Earthly uses it for tagging) | |
run: | | |
git config --global --add safe.directory "*" | |
branch="" | |
if [ -n "$GITHUB_HEAD_REF" ]; then | |
branch="$GITHUB_HEAD_REF" | |
else | |
branch="${GITHUB_REF##*/}" | |
fi | |
git checkout -b "$branch" || true | |
- uses: earthly/actions-setup@v1 | |
with: | |
version: v0.7.21 | |
# We always need to log in, in case we want to use caching | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Earthly bootstrap and configure | |
run: | | |
earthly config global.disable_analytics true | |
earthly config global.tls_enabled false | |
earthly --version | |
earthly bootstrap | |
- name: Run build (PR) | |
# Based on https://docs.github.com/en/actions/learn-github-actions/contexts#example-usage-of-the-github-context | |
if: ${{ github.event_name == 'pull_request' }} | |
env: | |
EARTHLY_PUSH: False | |
run: earthly --ci +all | |
- name: Login to Docker Hub | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Run build (branch) and publish | |
if: ${{ github.event_name != 'pull_request' }} | |
run: earthly --ci --push +all |