Skip to content

Commit

Permalink
initial attempt at ubuntu image build workflow (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
glitchcrab authored Aug 22, 2024
1 parent e151c64 commit 34339e3
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 1 deletion.
102 changes: 102 additions & 0 deletions .github/workflows/build-ubuntu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Build and push Ubuntu image

on:
push:
tags:
- 'v*.*.*'
paths:
- ubuntu/**
schedule:
- cron: "0 0 * * 1" # Every Monday at 00:00
workflow_dispatch:

env:
REGISTRY: docker.io
IMAGE_OWNER: glitchcrab
IMAGE_NAME: ubuntu-debug

jobs:
debug_info:
name: Debug info
runs-on: self-hosted
steps:
- name: Print github context JSON
run: |
cat <<EOF
${{ toJson(github) }}
EOF
build-on-push-trigger:
runs-on: self-hosted
if: github.event_name == 'push'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3

- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.IMAGE_OWNER }}
password: ${{ secrets.DOCKERHUB_TOKEN_UBUNTU }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{raw}}
type=schedule,pattern={{date 'YYYYMMDD'}}
type=raw,value=latest
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: "./ubuntu"
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

build-on-any-other-trigger:
runs-on: self-hosted
if: github.event_name != 'push'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3

- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.IMAGE_OWNER }}
password: ${{ secrets.DOCKERHUB_TOKEN_UBUNTU }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}
tags: |
type=schedule,pattern={{date 'YYYYMMDD'}}
type=raw,value=latest
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: "./ubuntu"
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ and this project's packages adheres to [Semantic Versioning](http://semver.org/s

## Unreleased

### Changed
### Added

- Initial attempt at a build workflow for Ubuntu.

## [v1.0.0] - 2020-08-15

Expand Down

0 comments on commit 34339e3

Please sign in to comment.