blob: 4c1c0b644e8fb353f26a4a213682bc79a213f20a [file] [log] [blame]
name: image
on:
pull_request:
push:
branches:
- main
release:
types:
- published
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v3
- name: Install Earthly
uses: earthly/actions-setup@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Authenticate to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
- name: Build image
run: earthly +image --tag ${{ github.sha }}
env:
EARTHLY_CI: true
EARTHLY_PUSH: "${{ github.event_name == 'push' }}"
EARTHLY_REMOTE_CACHE: ghcr.io/vexxhost/atmosphere:cache
publish:
runs-on: ubuntu-latest
if: github.event_name == 'release'
needs:
- build
steps:
- name: Authenticate to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
- name: Promote image
uses: akhilerm/tag-push-action@v2.1.0
with:
src: ghcr.io/vexxhost/atmosphere:${{ github.sha }}
dst: ghcr.io/vexxhost/atmosphere:${{ github.event.release.tag_name }}