Skip to content

Build

Build #26

name: Build
on: # yamllint disable-line rule:truthy
schedule:
- cron: '5 4 * * 6'
push:
branches: ["main"]
# paths:
# - components/containers/web-terminal/**
# - .github/workflows/**
pull_request:
branches: ["main"]
# paths:
# - components/containers/web-terminal/**
# - .github/workflows/**
concurrency:
group: web-terminal-tooling
jobs:
build-container:
runs-on: ubuntu-20.04
permissions:
contents: read
packages: write
outputs:
git-sha: ${{ steps.git-sha.outputs.sha }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set output for Git short SHA
id: git-sha
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Cache tooling binaries
uses: actions/cache@v4
id: cache-tooling-binaries
with:
path: container/tools-x86_64.tgz
key: ${{ hashFiles('container/bin.sh', 'container/download_tools.sh') }}
- name: Download tooling binaries
if: steps.cache-tooling-binaries.outputs.cache-hit != 'true'
run: |
cd container
./download_tools.sh
- name: Log into GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push images to ghcr.io
uses: docker/build-push-action@v5
with:
context: container
file: container/Containerfile
push: ${{ github.event_name != 'pull_request' }}
tags: |
ghcr.io/${{ github.repository_owner }}/web-terminal-tooling:git-${{ steps.git-sha.outputs.sha }}
ghcr.io/${{ github.repository_owner }}/web-terminal-tooling:latest
labels: org.opencontainers.image.version=${{ steps.git-sha.outputs.sha }}