Skip to content

Commit

Permalink
Merge pull request #840 from TheEadie/new-actions
Browse files Browse the repository at this point in the history
Update build and release pipelines for Worms Hub
  • Loading branch information
TheEadie authored Oct 11, 2024
2 parents 3efd01a + db2a75f commit 0fad5fd
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 45 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/hub-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Hub - Branches

on:
push:
branches-ignore:
- "main"

jobs:
build:
name: Build
uses: ./.github/workflows/hub-build.yml
50 changes: 5 additions & 45 deletions .github/workflows/hub.yml → .github/workflows/hub-build.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
name: Hub
name: Hub - Build

on:
push:
paths:
- "src/Directory.Build.props"
- "src/Worms.Hub*/**"
- "src/database/**"
- "build/docker/**"
- "build/release-github.sh"
- "build/version.sh"
- ".github/workflows/hub.yml"
workflow_call:

jobs:
build-gateway:
name: Package - Gateway
name: Gateway
runs-on: ubuntu-latest

steps:
Expand All @@ -36,7 +28,7 @@ jobs:
make gateway.package
build-replay-processor:
name: Package - Replay Processor
name: Replay Processor
runs-on: ubuntu-latest

steps:
Expand All @@ -59,7 +51,7 @@ jobs:
make replay-processor.package
build-database:
name: Build - Database
name: Database
runs-on: ubuntu-latest
env:
FLYWAY_EMAIL: ${{ secrets.FLYWAY_EMAIL }}
Expand Down Expand Up @@ -93,35 +85,3 @@ jobs:
info
migrate
info
release:
name: Release
runs-on: ubuntu-latest
needs: [build-gateway, build-replay-processor, build-database]
if: github.ref == 'refs/heads/main'

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3

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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: theeadie
password: ${{ secrets.DockerHubAccessToken }}

- name: Release
run: |
make gateway.release GITHUB_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }}
make replay-processor.release GITHUB_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }}
16 changes: 16 additions & 0 deletions .github/workflows/hub-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Hub - Main

on:
push:
branches:
- "main"

jobs:
build:
name: Build
uses: ./.github/workflows/hub-build.yml

release:
name: Release
needs: build
uses: ./.github/workflows/hub-release.yml
128 changes: 128 additions & 0 deletions .github/workflows/hub-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Hub - Release

on:
workflow_call:

jobs:

changes:
name: Detect Changes
runs-on: ubuntu-latest
outputs:
gateway: ${{ steps.filter.outputs.gateway || steps.filter.outputs.common }}
replay-processor: ${{ steps.filter.outputs.replay-processor || steps.filter.outputs.common }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Filter
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
gateway:
- 'src/Worms.Hub.Gateway/**'
- 'src/Worms.Hub.Storage/**'
replay-processor:
- 'src/Worms.Hub.ReplayProcessor/**'
- 'src/Worms.Hub.Storage/**'
- 'src/Worms.Armageddon.Game/**'
common:
- 'src/Directory.Build.props'
- '.github/workflows/hub-*.yml'
- 'build/docker/**'
release-gateway-github:
name: Gateway - GitHub
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.gateway == 'true' && github.ref == 'refs/heads/main' }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Release
run: |
make gateway.release.github GITHUB_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }}
release-gateway-dockerhub:
name: Gateway - DockerHub
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.gateway == 'true' && github.ref == 'refs/heads/main' }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3

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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: theeadie
password: ${{ secrets.DockerHubAccessToken }}

- name: Release
run: |
make gateway.release.dockerhub
release-replay-processor-github:
name: Replay Processor - GitHub
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.replay-processor == 'true' && github.ref == 'refs/heads/main' }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Release
run: |
make replay-processor.release.github GITHUB_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }}
release-replay-processor-dockerhub:
name: Replay Processor - DockerHub
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.replay-processor == 'true' && github.ref == 'refs/heads/main' }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3

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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: theeadie
password: ${{ secrets.DockerHubAccessToken }}

- name: Release
run: |
make replay-processor.release.dockerhub

0 comments on commit 0fad5fd

Please sign in to comment.