Skip to content

Commit

Permalink
Merge pull request #61 from Altonhe/feature/docker-ci
Browse files Browse the repository at this point in the history
feat: build and push tagged image upon a new release
  • Loading branch information
aaronbrethorst authored Mar 14, 2024
2 parents 6245853 + 6c61715 commit a883b92
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ on:
push:
branches:
- main
release:
types: [ published ]

jobs:
buildx:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -50,3 +53,47 @@ jobs:
tags: |
opentransitsoftwarefoundation/${{ matrix.name }}:latest
opentransitsoftwarefoundation/${{ matrix.name }}:${{ github.sha }}
buildx-release:
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
strategy:
matrix:
context: [ bundler, oba ]
include:
- name: onebusaway-bundle-builder
context: bundler
- name: onebusaway-api-webapp
context: oba
steps:
- name: Compute image tag name
run: echo "IMAGE_TAG=$(echo $GITHUB_REF_NAME)" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push images
uses: docker/build-push-action@v5
with:
context: ${{ matrix.context }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |
opentransitsoftwarefoundation/${{ matrix.name }}:${{ env.IMAGE_TAG }}

0 comments on commit a883b92

Please sign in to comment.