add Dockerfile and README to template #2
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
name: Build and publish image to ghcr.io/epics-containers | |
on: | |
push: | |
pull_request: | |
jobs: | |
build-push-images: | |
# pull requests are a duplicate of a branch push if within the same repo. | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository | |
permissions: | |
contents: read | |
packages: write | |
env: | |
CACHE: /tmp/.buildx-cache | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- architecture: linux | |
os: ubuntu-latest | |
platform: linux/amd64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.CACHE }} | |
key: ${{ runner.os }}-${{ matrix.architecture }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.architecture }}-buildx- | |
- name: Log in to GitHub Docker Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io/${{ github.repository_owner }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Docker Build Script | |
env: | |
ARCH: ${{ matrix.architecture }} | |
PLATFORM: ${{ matrix.platform }} | |
TAG: ${{ github.ref_name }} | |
PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }} | |
CACHE: ${{ env.CACHE }} | |
run: .github/workflows/build.sh | |
- name: Upload schema as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ioc-schema | |
path: ibek.ioc.schema.json | |
release: | |
# Release on tag push - publish ioc schema | |
needs: [build-push-images] | |
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: ioc-schema | |
path: ./ | |
- name: Github Release | |
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15 | |
with: | |
files: | | |
ibek.ioc.schema.json | |
generate_release_notes: true |