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(github): better build workflow #60

Merged
merged 22 commits into from
Jul 24, 2022
Merged
Show file tree
Hide file tree
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
259 changes: 175 additions & 84 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
name: Build and publish Docker images
name: Build Docker images

on:
schedule:
- cron: '0 0 * * *' # At 00:00.
push:
tags:
- '*.*.*'
branches:
- 'master'
pull_request:
branches:
- 'master'

jobs:
tf2-base:
runs-on: ubuntu-latest
outputs:
tf2-base-tag: ${{ steps.docker_meta.outputs.version }}
steps:
-
name: Checkout
Expand All @@ -23,187 +25,276 @@ jobs:
uses: docker/metadata-action@v4
with:
images: melkortf/tf2-base
tags: type=sha,format=long
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
name: Build
id: docker_build
uses: docker/build-push-action@v3
with:
context: ./packages/tf2-base
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
platforms: linux/amd64
load: true
-
name: Save docker image
run: docker save melkortf/tf2-base:${{ steps.docker_meta.outputs.version }} | gzip > /tmp/tf2-base.tar.gz
-
name: Upload docker image
uses: actions/upload-artifact@v2
with:
name: tf2-base
path: /tmp/tf2-base.tar.gz
if-no-files-found: error

tf2-sourcemod:
runs-on: ubuntu-latest
needs: tf2-base
outputs:
tf2-sourcemod-tag: ${{ steps.docker_meta.outputs.version }}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Download tf2-base
uses: actions/download-artifact@v2
with:
name: tf2-base
path: /tmp
-
name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: melkortf/tf2-sourcemod
tags: type=sha,format=long
-
name: Load tf2-base
run: |
docker load --input /tmp/tf2-base.tar.gz
docker image ls
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
name: Build
id: docker_build
uses: docker/build-push-action@v3
with:
context: ./packages/tf2-sourcemod
push: ${{ github.event_name != 'pull_request' }}
build-args: |
TF2_BASE_TAG=${{ needs.tf2-base.outputs.tf2-base-tag }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
load: true
pull: false
platforms: linux/amd64
-
name: Save docker image
run: docker save melkortf/tf2-sourcemod:${{ steps.docker_meta.outputs.version }} | gzip > /tmp/tf2-sourcemod.tar.gz
-
name: Upload docker image
uses: actions/upload-artifact@v2
with:
name: tf2-sourcemod
path: /tmp/tf2-sourcemod.tar.gz
if-no-files-found: error

tf2-tftrue:
tf2-mge:
runs-on: ubuntu-latest
needs: tf2-sourcemod
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Download tf2-sourcmeomd
uses: actions/download-artifact@v2
with:
name: tf2-sourcemod
path: /tmp
-
name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: melkortf/tf2-tftrue
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
images: melkortf/tf2-mge
tags: type=sha,format=long
-
name: Load tf2-sourcemod
run: |
docker load --input /tmp/tf2-sourcemod.tar.gz
docker image ls
-
name: Build and push
name: Build
id: docker_build
uses: docker/build-push-action@v3
with:
context: ./packages/tf2-tftrue
push: ${{ github.event_name != 'pull_request' }}
context: ./packages/tf2-mge
build-args: |
TF2_SOURCEMOD_TAG=${{ needs.tf2-sourcemod.outputs.tf2-sourcemod-tag }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
load: true
pull: false
platforms: linux/amd64
-
name: Save docker image
run: docker save melkortf/tf2-mge:${{ steps.docker_meta.outputs.version }} | gzip > /tmp/tf2-mge.tar.gz
-
name: Upload docker image
uses: actions/upload-artifact@v2
with:
name: tf2-mge
path: /tmp/tf2-mge.tar.gz
if-no-files-found: error

tf2-competitive:
tf2-tftrue:
runs-on: ubuntu-latest
needs: tf2-tftrue
needs: tf2-sourcemod
outputs:
tf2-tftrue-tag: ${{ steps.docker_meta.outputs.version }}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Download tf2-sourcmeomd
uses: actions/download-artifact@v2
with:
name: tf2-sourcemod
path: /tmp
-
name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: melkortf/tf2-competitive
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
images: melkortf/tf2-tftrue
tags: type=sha,format=long
-
name: Load tf2-sourcemod
run: |
docker load --input /tmp/tf2-sourcemod.tar.gz
docker image ls
-
name: Build and push
name: Build
id: docker_build
uses: docker/build-push-action@v3
with:
context: ./packages/tf2-competitive
push: ${{ github.event_name != 'pull_request' }}
context: ./packages/tf2-tftrue
build-args: |
TF2_SOURCEMOD_TAG=${{ needs.tf2-sourcemod.outputs.tf2-sourcemod-tag }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
load: true
pull: false
platforms: linux/amd64
-
name: Save docker image
run: docker save melkortf/tf2-tftrue:${{ steps.docker_meta.outputs.version }} | gzip > /tmp/tf2-tftrue.tar.gz
-
name: Upload docker image
uses: actions/upload-artifact@v2
with:
name: tf2-tftrue
path: /tmp/tf2-tftrue.tar.gz
if-no-files-found: error

tf2-mge:
tf2-competitive:
runs-on: ubuntu-latest
needs: tf2-sourcemod
needs: tf2-tftrue
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Download tf2-tftrue
uses: actions/download-artifact@v2
with:
name: tf2-tftrue
path: /tmp
-
name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: melkortf/tf2-mge
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
images: melkortf/tf2-competitive
tags: type=sha,format=long
-
name: Load tf2-tftrue
run: |
docker load --input /tmp/tf2-tftrue.tar.gz
docker image ls
-
name: Build and push
name: Build
id: docker_build
uses: docker/build-push-action@v3
with:
context: ./packages/tf2-mge
push: ${{ github.event_name != 'pull_request' }}
context: ./packages/tf2-competitive
build-args: |
TF2_TFTRUE_TAG=${{ needs.tf2-tftrue.outputs.tf2-tftrue-tag }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
load: true
pull: false
platforms: linux/amd64
-
name: Save docker image
run: docker save melkortf/tf2-competitive:${{ steps.docker_meta.outputs.version }} | gzip > /tmp/tf2-competitive.tar.gz
-
name: Upload docker image
uses: actions/upload-artifact@v2
with:
name: tf2-competitive
path: /tmp/tf2-competitive.tar.gz
if-no-files-found: error

tf2-dm:
runs-on: ubuntu-latest
needs: tf2-sourcemod
needs: tf2-tftrue
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Download tf2-tftrue
uses: actions/download-artifact@v2
with:
name: tf2-tftrue
path: /tmp
-
name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: melkortf/tf2-dm
tags: type=sha,format=long
-
name: Load tf2-tftrue
run: |
docker load --input /tmp/tf2-tftrue.tar.gz
docker image ls
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
name: Build
id: docker_build
uses: docker/build-push-action@v3
with:
context: ./packages/tf2-dm
push: ${{ github.event_name != 'pull_request' }}
build-args: |
TF2_TFTRUE_TAG=${{ needs.tf2-tftrue.outputs.tf2-tftrue-tag }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
load: true
pull: false
platforms: linux/amd64
-
name: Save docker image
run: docker save melkortf/tf2-dm:${{ steps.docker_meta.outputs.version }} | gzip > /tmp/tf2-dm.tar.gz
-
name: Upload docker image
uses: actions/upload-artifact@v2
with:
name: tf2-dm
path: /tmp/tf2-dm.tar.gz
if-no-files-found: error
Loading