fix: Improve workflow for main branch and PRs (#17)

This makes it so that the main branch will push images but PRs won't.
This also puts integration tests back in the `+all` target.
This commit is contained in:
Gerald Pinder 2024-01-27 12:44:54 -05:00 committed by GitHub
parent c32a0604ce
commit 097dbb391a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 38 additions and 7 deletions

27
.github/workflows/build-pr.yml vendored Normal file
View file

@ -0,0 +1,27 @@
name: Earthly PR +build
on:
pull_request:
env:
FORCE_COLOR: 1
jobs:
build:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: earthly/actions-setup@v1
with:
use-cache: true
version: v0.8.2
# Setup repo and add caching
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.ref }}
- name: Run build
run: earthly --ci -P +build

View file

@ -1,9 +1,7 @@
name: Earthly +build name: Earthly main branch +build
on: on:
workflow_dispatch: workflow_dispatch:
merge_group:
pull_request:
push: push:
branches: branches:
- main - main
@ -15,17 +13,19 @@ jobs:
build: build:
permissions: permissions:
packages: write packages: write
timeout-minutes: 30 timeout-minutes: 60
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: earthly/actions-setup@v1 - uses: earthly/actions-setup@v1
with: with:
use-cache: true use-cache: true
version: v0.8.0 version: v0.8.2
# Setup repo and add caching # Setup repo and add caching
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with:
ref: main
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
@ -35,4 +35,4 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Run build - name: Run build
run: earthly --push --ci -P +all run: earthly --push --ci -P +build

View file

@ -1,4 +1,4 @@
name: Earthly +tag name: Earthly tag +build
on: on:
push: push:

View file

@ -5,6 +5,10 @@ IMPORT github.com/blue-build/earthly-lib/cargo AS cargo
ARG --global IMAGE=ghcr.io/blue-build/cli ARG --global IMAGE=ghcr.io/blue-build/cli
all: all:
BUILD +build
BUILD +integration-tests --NIGHTLY=true --NIGHTLY=false
build:
BUILD +default BUILD +default
BUILD +nightly BUILD +nightly