Skip to content

Commit

Permalink
Add GHA workflow to build the builder image
Browse files Browse the repository at this point in the history
  • Loading branch information
imsodin committed Jul 14, 2023
1 parent d753c26 commit f257bd3
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build/Release

on:
pull_request:
workflow_dispatch:

jobs:
build-image:
if: github.event_name == 'pull_request'
uses: ./.github/workflows/image-builder-template.yaml
with:
push: false

push-image:
if: github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/image-builder-template.yaml
with:
push: true
40 changes: 40 additions & 0 deletions .github/workflows/image-builder-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Image Builder Template

on:
workflow_call:
inputs:
push:
required: true
type: boolean

env:
# Our build metadata
BUILD_USER: builder
BUILD_HOST: github.syncthing.net
# template var
image: ghcr.io/syncthing/syncthing-android-builder

jobs:
build-image:
name: Build Builder Docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true

- uses: docker/setup-buildx-action@v2

- uses: docker/login-action@v2
if: ${{ inputs.push }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
tags: '${{ env.image }}:latest,${{ env.image }}:${{ github.sha }}'
push: ${{ inputs.push }}

0 comments on commit f257bd3

Please sign in to comment.