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

initial attempt at ubuntu image build workflow #4

Merged
merged 1 commit into from
Aug 22, 2024
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
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