Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: trigger docker on release #122

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,52 @@
name: Create and publish a Docker image

on:
workflow_dispatch:
push:
branches: ['main', 'staging']
tags: ['v*']
workflow_dispatch:
workflow_run:
workflows: [Releaser]
types:
- completed

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
prepare_checkout:
if: (
github.repository == 'ipfs/rainbow'
|| github.event_name == 'workflow_dispatch'
) && (
github.event_name != 'workflow_run'
|| github.event.workflow_run.conclusion == 'success'
)
name: Decide what ref to check out
runs-on: ubuntu-latest
outputs:
ref: ${{ github.event_name != 'workflow_run' && github.ref || steps.releaser.outputs.version }}
steps:
- name: Inspect triggering Releaser workflow run
id: releaser
if: github.event_name == 'workflow_run'
uses: ipdxco/unified-github-workflows/.github/actions/[email protected]
with:
artifacts-url: ${{ github.event.workflow_run.artifacts_url }}
build-and-push-image:
needs: [prepare_checkout]
if: needs.prepare_checkout.outputs.ref != ''
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ needs.prepare_checkout.outputs.ref }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

Expand Down
Loading